Question: In Assembly Language x86 Proccessor using Visual studios INCLUDE: Irvine32.inc Write a program that asks the user to guess the next roll of a six

In Assembly Language x86 Proccessor using Visual studios INCLUDE: Irvine32.inc

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 $ 100.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).

Your program should look something like this:

Your bank is $10.00 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: 6 Sorry, the dice rolled a 5. continue? y Your bank is $9.00 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:

4 Winner! the dice rolled a 4. continue? n Thanks for playing your bank is $19.00

. Come back real soon:

RandomRange PROC Generates an unsigned pseudo-random 32-bit integer in the range of 0 through (n-1).

Call args: EAX = n, the range Return arg: EAX = random (0 to n-1) Example: Get a random number from 1 to 100 .data ranNum DWORD ? .code mov eax,100 ;get random 0 to 99 call RandomRange ; inc eax ;make range 1 to 100 mov ranNum,eax ;save random number 

To generate a 32-bit random number, use the Random32 Procedure:

Random32 PROC Generates an unsigned pseudo-random 32-bit integer in the range of 0 through FFFFFFFFh.

Call args: None Return arg: EAX = random (0 to FFFFFFFFh) Example: .data ranNum DWORD ? .code call Random32 mov ranNum,eax ;save 

Randomize PROC Re-seeds the random number generator with the current time in hundredths of seconds.

Call args: None Return arg: None Example: call Randomize ;re-seed generator 

The output of your game should look something like this but please note it is difficult to show you each iteration.

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 Databases Questions!