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 pseudo-code is as follows:
The program generates a random number from 1 to 100.
The user gets up to 7 attempts to guess the number.
o If the guess (must be from 1 to 100) matches the random number before making the 7th 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 7th guess, an appropriate message is displayed (You Lose! and what the correct number actually was) and the game is over
o Otherwise, if a non-match and fewer than 7 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 1 to 100
Set Number of Guesses =0
DO
o DO
Prompt user for next guess
IF guess >=1 and <=100
Print error message; ask to user enter a different number
o WHILE guess <1 or >100
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 <7
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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!