subject

Need 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).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
There is a simple pattern for determining if a binary number is odd. what is it and why does this pattern occur? how many bits would you need if you wanted to have the ability to count up to 1000? how high could you count in binary if you used all 10 of your fingers as bits? (finger up means 1, finger down means 0)
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
question
Computers and Technology, 24.06.2019 06:30
Ineed to know the anwser to all these questions
Answers: 2
You know the right answer?
Need with this c++ program.

use the following multi-dimension array declaration in mai...
Questions
question
Mathematics, 20.09.2021 09:50
question
Social Studies, 20.09.2021 09:50
Questions on the website: 13722362