Question
Two dimensional arrays Many problems can be done using two dimensional arrays. For example, all the chess games, go games, can be implemented using two
Two dimensional arrays
Many problems can be done using two dimensional arrays. For example, all the chess games, go games, can be implemented using two dimensional arrays. Note all the matrices you learn in linear algebra are two dimensional arrays.
Here we use the easiest one: tic-tac-toe as mentioned by Deitel, in example 10.11, on page 404.
Tic Tac Toe (15%) (as two dimensional array).
Implement the two dimensional tic-tac-toe on 3-by-3 rectangular array as Deitel stated here. Notice that the two players take turns to paly by placing 1 and 2 (or o and x) on the square. Each move must be to an empty square, and game is over if one player has 3 in a line (row, column, or diagonal). Your game must state game is over when one side wins, or at the end of the 9th move, states that it is a draw.
Show two games where one game has a winner and another game is a draw. Ignore the authors suggestion of having computer playing against a player or develop a three-dimensional Tic-Tac-Toe.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started