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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 13PP
icon
Related questions
Question

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)

  1. Update the while loop condition to iterate eight times versus four

  2. Before calling function displayStats for each player, call function

    updateDiscCount for each player passing arguments

    1. Array board

    2. The player’s struct (i.e. playerX or playerO, as a pointer)

  3. After the end of the while loop, repeat the following function

    calls

    1. Call function displayBoard

    2. Call function updateDiscCount for each player

    3. 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);    

    }

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning