So for this assignment we have to inherit from the base class 'Game'
I think I have with my version named 'ChildGame'
I would like help with checking the syntax of my function calls from main()
/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen.
****************************************************************************************/
//headers (if not already included in parent class)
/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
const int MAX = 3;
class Game {
protected:
char Board[MAX][MAX]; //Store the actually board for the game
int iTotalMoves; //How many moves have happened in the game
public:
Game() : iTotalMoves(0)
{ ResetBoard(); }
void DrawRow(char cRow[]) {
//This member function will print out one row of the 3 row tic-tac-toe board
}
void DrawGame() {
//This member function will print the entire tic-tac-toe board. This member function calls the
//DrawRow() function which will draw the rows of the board
}
void ResetBoard() {
//This member function will reset the board to all blank to start the tic-tac-toe game
for(int iRow = 0; iRow < MAX; iRow++) {
for(int iCol = 0; iCol < MAX; iCol++) {
Board[iRow][iCol] = ' ';
}
}
}
void UserInput(char cPlayerSymbol) {
//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
//sure to check if another X or O is already in that position.
}
bool CheckMove(int iRow, int iColumn) {
//This member function checks to see if the move was a valid move or not. This is called from UserInput.
}
void ComputerMove(char cPlayer, char cComputer) {
//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
//positions on the board and make sure that you block any human player win attempts. Then if there are no
//human win attempts, make the best move possible.
}
bool CheckWin(char cPlayer) {
//This member function will check all winning combinations on the board to see if anyone won or if it is a
//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
//the game is over (Cats game).
}
};
// END OF CPOLEN'S CODE
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________
//================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------
//child class of polen's code above.......
class ChildGame : public Game
{
protected:
char Board[MAX][MAX]; //Store the actually board for the game
int iTotalMoves; //How many moves have happened in the game
public:
ChildGame() : iTotalMoves(0)
{ ResetBoard(); }
void DrawRow(char cRow[]) {
//This member function will print out one row of the 3 row tic-tac-toe board
}
void DrawGame() {
//This member function will print the entire tic-tac-toe board. This member function calls the
//DrawRow() function which will draw the rows of the board
}
void ResetBoard() {
//This member function will reset the board to all blank to start the tic-tac-toe game
for(int iRow = 0; iRow < MAX; iRow++) {
for(int iCol = 0; iCol < MAX; iCol++) {
Board[iRow][iCol] = ' ';
}
}
}
void UserInput(char cPlayerSymbol) {
//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
//sure to check if another X or O is already in that position.
}
bool CheckMove(int iRow, int iColumn) {
//This member function checks to see if the move was a valid move or not. This is called from UserInput.
}
void ComputerMove(char cPlayer, char cComputer) {
//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
//positions on the board and make sure that you block any human player win attempts. Then if there are no
//human win attempts, make the best move possible.
}
bool CheckWin(char cPlayer) {
//This member function will check all winning combinations on the board to see if anyone won or if it is a
//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
//the game is over (Cats game).
}
};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{
cout<<"main()"<<endl;
do
{
ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
MyGame.ChildGame::DrawRow(char cRow[]);//create board
MyGame.ChildGame::DrawGame();//prints board
MyGame.ChildGame::UserInput(char cPlayerSymbol);//user input
MyGame.ChildGame::CheckMove(int iRow, int iColumn);
MyGame.ChildGame::ComputerMove(char cPlayer, char cComputer);
}
while(MyGame.ChildGame::CheckWin(char cPlayer););
system ("pause");
return 0;
}