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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:40, silviamgarcia
Pthreads programming: create and terminate a thread write a c++ program that creates a thread. the main will display a message “hello world from the main”. the main will create a thread that will display a message “hello world from the thread” and then terminates with a call to pthread_exit()
Answers: 3
image
Computers and Technology, 22.06.2019 16:30, buky0910p6db44
Corey set up his presentation for delivery to his team. the information he had to convey was critical to their job performance. he knew he would need a lot of time to explain each point
Answers: 3
image
Computers and Technology, 23.06.2019 00:10, makailaaa2
My has been slow anyone else’s ?
Answers: 1
image
Computers and Technology, 23.06.2019 04:00, terrell31
Write a method that takes in an array of point2d objects, and then analyzes the dataset to find points that are close together. be sure to review the point2d api. in your method, if the distance between any pair of points is less than 10, display the distance and the (x, y)s of each point. for example, "the distance between (3,5) and (8,9) is 6.40312." the complete api for the point2d adt may be viewed at ~pf/sedgewick-wayne/algs4/documenta tion/point2d. html (links to an external site.)links to an external site.. try to write your program directly from the api - do not review the adt's source code.
Answers: 1
You know the right answer?
Need with this c++ program.

use the following multi-dimension array declaration in mai...

Questions in other subjects:

Konu
English, 22.04.2021 02:00
Konu
Social Studies, 22.04.2021 02:00