Wheel of Fortune
ID: 3532636 • Letter: W
Question
## If the program works in QtSpim i will automatically award all 5 stars gaurentee!
## please use proper indentation and spacing dont let it look sloppy please goodluck!
##check the functions and comments at the bottom to see what you need to implement and dont ##forget
##about the main function either if changes need to be made, its the wheel of fortune game
.data
menu_data: .ascii " ********************* "
.ascii " Menu "
.ascii " 1. Guess a letter "
.ascii " 2. Guess the phrase "
.ascii " 3. View answer "
.ascii "********************* "
.byte 0
prompt1: .asciiz "Enter your choice: "
prompt2: .asciiz "Enter your guess: "
message1: .asciiz " Congratulations! Your guess was correct!"
message2: .asciiz " Sorry, your guess was wrong."
message3: .asciiz "There is(are) "
message4: .asciiz " match(es)"
message5: .asciiz " Game Over!"
phrase: .asciiz "I LOVE PROGRAMMING "
string_space: .space 64 # set aside 1024 bytes for the string.
cover: .space 64
.text
main:
la $a0, phrase
la $a1, cover
jal generate_stars #inlitialize the puzzle to something like * **** ********
loop: la $a0, menu_data #print menu
li $v0, 4
syscall
la $a0, cover
li $v0, 4
syscall
la $a0, prompt1 #ask user enter choice
li $v0, 4
syscall #print a string whose address is in $a0
li $v0, 5 #read an int
syscall
add $s0, $v0, $zero #$s0 hold the input
li $t0, 1
beq $s0, $t0, case1
li $t0, 2
beq $s0, $t0, case2
li $t0, 3
beq $s0, $t0, case3
j loop
case1:
la $a0, prompt2 #prompt user to input a char
li $v0, 4
syscall
li $v0, 12 #get user's input
syscall
move $a0, $v0
la $a1, phrase
la $a2, cover
jal check_char # check the char answer
move $t0, $v0 #$t0 hold the result
beq $t0, $zero, no_match_message
la $a0, message1
li $v0, 4
syscall
j end_case1
no_match_message:
la $a0, message2
li $v0, 4
syscall
end_case1:
la $a0, message3
li $v0, 4
syscall
move $a0, $t0
li $v0, 1
syscall
la $a0, message4
li $v0, 4
syscall
j loop
case2: la $a0, prompt2
li $v0, 4
syscall #print a string whose address is in $a0
la $a0, string_space #string address
li $a1, 64 #string length
li $v0, 8 #read a string
syscall
jal alltoupper #convert input to all uppercase, string_space is already in $a0
la $a0, string_space
la $a1, phrase
jal is_match
beq $v0, $zero, not_match
la $a0, message1
li $v0, 4
syscall
j exit #match whole sentence, display message and game over
not_match:
la $a0, message2
li $v0, 4
syscall
j exit #not match whole sentence, display message and game over
case3:
la $a0, phrase
li $v0, 4
syscall
exit: li $v0, 10
syscall
## these right here are the functions I need help to fill in to complete my project
## initialize the puzzle display as something liks * **** **********
generate_stars:
## is match function. Return 1 if two given strings are match, return 0 otherwise
is_match:
## return the argument itself if it is NOT a lower case letter
## otherwise, return its upper case
toupper:
## check if the given char is in the phrase and count how many
## there are three arguments: the given char ($a0), the given phrase (address in $a1),
## and the cover of the phrase (address in $a2)
## the cover of the phrase will be change accordingly, i.e. reveal the correctly guessed char
check_char:
## alltoupper
## convert a sentence to all upper case
## assume that the sentence address is stored in $a0
alltoupper:
Explanation / Answer
Wheel of Fortune - Official Site Skip to Content Skip to content Sony make.believe Sony Pictures Search SonyPictures.com Query
Wheel Watchers Club SPIN ID
Join Now Join NowThink you saw your SPIN ID on TV?
VerifyRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.