Question
ASSIGNMENT: For this assignment, you are required to write a MIPS program that allows users to play an interactive game of Tic Tac Toe (Naughts
ASSIGNMENT: For this assignment, you are required to write a MIPS program that allows users to play an interactive game of Tic Tac Toe (Naughts and Crosses). Represent your game board as a two-dimensional array of characters, with three rows and three columns. Other useful global variables include the following: 1. whoseMove: a character used to remember which player get to make the next move. The value of whoseMove should alternate between X and O as the game proceeds. 2. moveCount: an integer used to count the number of moves made during the current game. At a minimum, your solution should include the following methods: 1. ResetBoard: this void method clears the Tic Tac Toe board, sets whoseMove to X, and sets moveCount to 0. 2. AddMove: this void method interactively prompts for and reads two integer values representing a selected row and column. Your method should display an appropriate error message and repeat the input process until the user enters row and column numbers between 1 and 3, inclusive, that specify an unoccupied board position. It should then place the current players token (X or O) in the selected position. 3. DisplayBoard: this void method displays the current content of the board on the screen. 4. IsAWin: this method returns a Boolean value that indicates whether the most recent move resulted in a win, which may occur in the current row, the current column, or along either diagonal. Your main method should use these methods to allow users to play Tic Tac Toe. After each move, display the updated board on the screen. Loop until the game ends in a win or a draw (which occurs when the moveCount reaches 9 without a win). Your program should ask users whether they would like to play another game, and repeat until they decide not to do so. Be sure to reset the board at the beginning of each game.
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