Question: Need help with this c++ program. Use the following multi-dimension array declaration in main() to create the simplifiedtwo player tic-tac-toe game (see Notes below for

Need help with this c++ program.

Use the following multi-dimension array declaration in main() to create the simplifiedtwo player tic-tac-toe game (see Notes below for important game variation)

int ttt[3][3] = { { 0,0,0 }, { 0,0,0 }, { 0,0,0 } }; //int ttt[3][3] = { 0 }; alternate way to code this!

Your program should implement and use the following functions

void render(int arr[3][3]);

displays the current state of the tic-tac-toe game in simple grid form.

void currentMove(int arr[3][3], int row, int col, int value);

updates the array with a value at the given row and col position(presumably 1 or 2). No validation is required (i.e. existing moves can beoverwritten).

int checkWin(int arr[3][3]); returns the winner as an int (i.e. 1, 2, or 0 if there is no winner yet)

OR if you prefer (or another arrangement that can determine the winner) - bool checkPlayer1(int arr[3][3]);bool checkPlayer2(int arr[3][3]);

returns true if respective player wins, false if not. This maybe a little easier to program and implement than checkWin.

Notes: main() should prompt players 1 and 2 to input column and row values (and renderthe results) until a winner is detected. A major change from traditional tic-tac-toe rules isthat there is NO validation or prohibition against a player selecting a cell alreadyselected. The program simply keeps track of moves (and renders them), and checks for awinner (with no move validation). You of course are welcome to validate moves if youlike (but this raises the additional issue of determining when a cats game occurs which is beyond the required scope of this project).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!