csci 10 :: programming challenge 5 (due wed, sep 21)

For this challenge you will implement a simple three-wheel slot machine simulator. The user will be provided with an initial "bankroll" of \$1000 (stored in an uns16 variable) and will wager \$1 to \$3 before each spin of the wheel. Each wheel will have three (3) possible results: @CHERRY@ (80% probability), \$MONEY\$ (15% probability), *STAR* (5% probability). Possible results will be as follows:

1. if all three wheels do not match, player loses her/his wager -- subtract the wager amount from the bankroll
2. all three wheels land on @CHERRY@ -- player wins wager amount -- add wager amount to the bankroll
3. all three wheels land on \$MONEY\$ -- player wins double wager amount -- multiply the wager amount by two (2) and add the winnings to the bankroll
4. all three wheels land on *STAR* -- player wins triple wager amount -- multiply the wager amount by three (3) and add the winnings to the bankroll

Format your documentation and HLA source code using hla_starter.txt as a style guide.

Write, compile, and execute a complete HLA program that does the following:

• [10 points] declare two static uns16 variables, one to represent the player's starting "bankroll" and the other to store the player's wager for each round the player "spins the wheel" of the simulated slot machine
• [15 points] has a robust getUns16 procedure that takes a string parameter representing the user prompt (for example, for this program an appropriate prompt might be "enter your wager", and min and max parameters; guarantees a user input value in the range min to max inclusive; returns the input value in ax; @forward declare the procedure
• [15 points] a "showSymbol" procedure that takes a single uns32 parameter and displays @CHERRY@ if the parameter value is 1, \$MONEY\$ if the parameter value is 2, and *STAR* if the parameter value is 3
• [25 points] a "spinOneWheel" procedure that:
• uses rand.urange to produce a value between 1 and 100 inclusive
• if random value < 80, returns 1
• if random value < 95, returns 2
• otherwise returns 3
• returns the value in eax
• [35 points] a "spinAllWheels" procedure that:
• has three (3) local, automatic variables wheelOne, wheelTwo, and wheelThree
• calls spinOneWheel three (3) times and assigns the returned values to wheelOne, wheelTwo, and wheelThree
• calls showSymbol three (3) times with wheelOne, wheelTwo, and wheelThree as arguments
• returns 0 if all three wheels do not match
• returns 1 if all three wheels are @CHERRY@ (i.e., wheelOne, wheelTwo, and wheelThree all have the value 1
• returns 2 if all three wheels are \$MONEY\$
• returns 3 if all three wheels are *STAR*
• return value must be stored in al
• [35 points] the main program loop:
• gets the user's wager using getUns16
• calls spinAllWheels
• computes winnings based on the value returned by spinAllWheels:
• returns 0 -- subtract wager from user's bankroll
• returns 1 -- add wager to user's bankroll
• returns 2 -- multiply wager by 2, add result to user's bankroll
• returns 3 -- multiply wager by 3, add result to user's bankroll
• [15 points] allows the player to keep playing until either (1) the player chooses to quit or (2) the player runs out of money in her/his bankroll

WARNING: if your code will not compile you will get a zero (0) on the assignment.