Write a program that asks the user to guess the next roll of a six sided die. Each guess costs \$ 1. If they guess correctly, they get \$ 10.00. The player will start out with a \$10.00 bank. Each time he (or she) guesses incorrectly you will subtract \$1.00 from their bank. Each time they guess correct, you add \$10.00 to their bank. Print the total winnings or loss at the end of the game. You can simulate the toss of the dice using the RandomRange function (Don't forget to Randomize). It should use .WHILE, .ENDW, .IF, .ELSE, .ENDIF instructions

The program should look something like this:

Welcome to the dice guess game. it costs \$1.00 to play.
Would you like to continue? (y/n)

y
Please enter your guess for the next roll. It only costs \$1.00 to play
If you are correct I will pay you \$10.00:
5
Winner!
Would you like to continue? (y/n)

y
Please enter your guess for the next roll. It only costs \$1.00 to play
If you are correct I will pay you \$10.00:
3
Sorry you lose. The dice rolled 1
Would you like to continue? (y/n)

y
Please enter your guess for the next roll. It only costs \$1.00 to play
If you are correct I will pay you \$10.00:
2
Sorry you lose. The dice rolled 3
Would you like to continue? (y/n)

n
Thanks for Playing

Press any key to close this window . . .

What I currently have:

``````INCLUDE asmlib.inc
.data
promptA BYTE "Do you want to play (y/n)", 0         ; prompt
promptB BYTE "Play again (y/n) ", 0                     ; prompt2
.code

main PROC

mov edx, OFFSET promptA                 ; mov prompt into edx
call writeLine                                   ; ask for number
call readChar                                       ; Transfer character strings to and from connections
L1:

cmp al, 'y'                                         ; subtracts one operand from the other for comparing whether the operands are equal or not
jne EXITOUT                                         ; exit

mov edx, OFFSET promptB                  ; mov prompt into edx
call writeLine                                      ; ask for number
call readChar                                       ; Transfer character strings to and from connections
jmp L1                                                  ; loop

EXITOUT:                                             ; exit

exit
main ENDP
END main``````

That's a good start. It looks like you need to keep writing more code. As this looks like your homework you need to write it all yourself and call for help when some code doesn't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.