Answer to Question #52349 in MatLAB | Mathematica | MathCAD | Maple for Ray

Question #52349
Tic-Tac-Toe (a.k.a. Noughts and crosses) is a game played by two players (‘X’ and ‘O’) on a 3x3 grid. In MATLAB, use a 3x3 cell array to hold the board information. Take it in turns to play the game, inserting ‘X’s and ‘O’s at various spots. Implement the following structure plan in MATLAB.

1) Commence the game, display empty board
2) Select which player is ‘X’ and ‘O’ (at random)
3) Request player1’s move
4) Input Player1’s move. Redraw updated board.
5) Decision: has the game been won yet? If so, go to step 9). If not, go to step 6).
6) Request player2’s move
7) Input Player2’s move. Redraw updated board.
8) Decision: has the game been won yet? If so, go to step 9). If not, go back to step 3).
9) Display winner on the screen.
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS