Update function playGame to do the following a. When prompting the players for their name i. Set the value for struct field playChar to the associated character for each player (i.e. X or O) Update the while loop condition to iterate eight times versus four Before calling function displayStats for each player, call function updateDiscCount for each player passing arguments Array board The player’s struct (i.e. playerX or playerO, as a pointer) After the end of the while loop, repeat the following function calls Call function displayBoard Call function updateDiscCount for each player Call function displayStats for each player
I keep getting an "undefined symbol: _updateDiscCount" error.
This is what I am trying to achieve:
Update function playGame to do the following
a. When prompting the players for their name
i. Set the value for struct field playChar to the associated character for each player (i.e. X or O)
-
Update the while loop condition to iterate eight times versus four
-
Before calling function displayStats for each player, call function
updateDiscCount for each player passing arguments
-
Array board
-
The player’s struct (i.e. playerX or playerO, as a pointer)
-
-
After the end of the while loop, repeat the following function
calls
-
Call function displayBoard
-
Call function updateDiscCount for each player
-
Call function displayStats for each player
-
This is the code having issues with: I cannot copy the entire code so I will add the part that is having issues. The "void updateDiscCount();" is my function prototype declared after the libraries
void updateDiscCount();
void playGame()
{
// declare variable for each player as a struct
struct Player playerX;
struct Player playerO;
// Othello board
char board[ROW][COL]; // this is really a memory location of board[0][0]
// black (X) always goes first
int currentPlayer = PLAYER_X;
int loop = ZERO;
printf("Player X, please enter your name\n");
scanf("%s", playerX.playerName);
playerX.playChar = PLAYER_X;
playerX.discCount = TWO;
printf("Player O, please enter your name\n");
scanf("%s", playerO.playerName);
playerO.playChar = PLAYER_O;
playerO.discCount = TWO;
printf("%s and %s, let's play Othello!\n", playerX.playerName, playerO.playerName);
// call function initializeBoard
initializeBoard(board);
while(loop < EIGHT)
{
// call function displayBoard
displayBoard(board);
// request the player's move
if(currentPlayer == PLAYER_X)
{
makeMove(&playerX, board);
currentPlayer = PLAYER_O;
}
else if(currentPlayer == PLAYER_O)
{
makeMove(&playerO, board);
currentPlayer = PLAYER_X;
}
updateDiscCount(board, &playerX);
updateDiscCount(board, &playerO);
displayStats(playerX);
displayStats(playerO);
loop++;
displayBoard(board);
updateDiscCount(playerX);
updateDiscCount(playerO);
displayStats(playerO);
displayStats(playerX);
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images