Question: Write a MIPS program for the Guessing Game . The pseudo - code is as follows: The program generates a random number from 1 to
Write a MIPS program for the Guessing Game The pseudocode is as follows:
The program generates a random number from to
The user gets up to attempts to guess the number.
o If the guess must be from to matches the random number before making the th unsuccessful guess, an appropriate message is displayed You Win! and the game is over.
o If the guess is incorrect and this was the users th guess, an appropriate message is displayed You Lose! and what the correct number actually was and the game is over
o Otherwise, if a nonmatch and fewer than guesses attempted, an appropriate message is displayed Sorry too high or Sorry too low the number of guesses remaining is displayed, and the user is prompted for their next guess.
Submit your MIPS source code text file either asm or txt file extension that solves this problem. Be sure to include appropriate comments. The MIPS program must assemble without errors for any credit consideration, even if the program when run produces an incorrect result.
Guessing Game: Flow Control Template
Get Random number from to
Set Number of Guesses
DO
o DO
Prompt user for next guess
IF guess and
Print error message; ask to user enter a different number
o WHILE guess or
o IF guess random number
Print message Too Low
o ELSE IF guess random number
Print message Too High
o ELSE IF guess random number
Print Congratulations you won
Exit the program
o Increment guess count
WHILE number of guesses
Print You reached maximum number of guesses
Print The number was and the random number
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
