I\'m making the game of Reversi in C++ How do I go about: -Making a class named
ID: 3807357 • Letter: I
Question
I'm making the game of Reversi in C++ How do I go about: -Making a class named board that represents the game board -making an abstract base class called player. -making a class called Human_player derived from player class -making a class called Computer_player derived from player I'm making the game of Reversi in C++ How do I go about: -Making a class named board that represents the game board -making an abstract base class called player. -making a class called Human_player derived from player class -making a class called Computer_player derived from player How do I go about: -Making a class named board that represents the game board -making an abstract base class called player. -making a class called Human_player derived from player class -making a class called Computer_player derived from playerExplanation / Answer
This is how you can define the classes. Please provide more info on the requirements such as what properties each player has, etc..
#include <iostream>
using namespace std;
const int NUM_ROWS = 8;//Global constant variable
const int NUM_COLS = 8;//Global constant variable
//board class
class board
{
public:
//array to represent your board
int gameboard[NUM_ROWS][NUM_COLS];
};
//abstract class Player with a pure virtual function
class Player {
public:
//This is a virtual function which makes this class abstract
virtual void someData() = 0;
};
//human player class
class Human_player: public Player
{
public:
Human_player();
};
//computer player class
class Computer_player: public Player
{
public:
Computer_player();
};
int main() {
// your code goes here
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.