Concepts Need: random numbers nested if statements object parameters in methods Slot Machine Problem - Phase 1Create an Alice program that will simulate a slot machine. The slot machine will have three “wheels” that will "display" the numbers from 1 to 6. The numbers are displayed by changing the colour of the "wheels". Required Objects: one "wheel" 3D-Text for the players name 3D-Text for the number Tokens a lever Your program will take as input: the player’s name the number of tokens in the player’s bank (there will be at least one and fewer than 100) Your program will out number of times the player plays the player's name the number of tokens in the player's bank First
Slot Machine Problem – Phase 2Objects to Add: two more wheels Modify your Phase 1 Slot Machine program, so that you will use one method to spin all the wheels of the slot machines. This will be accomplished by creating a method that uses an object as a parameter. For a sample program see 008AliceTips-ObjectsAsParameters in 1.1 Alice Programs: Tips and Tricks Convert your world class method to change the colour of one "wheel" to use object parameters. June 2011 -- I will help you convert your method to use object parmeters The machine will pay: 10 to 1 if all three wheels match 5 to 1 for two matching wheels. Logic Method #1 if all three wheels are the same colour pay 10 else if wheel 1 and wheel 2 are the same colour pay 5 if wheel 2 and wheel 3 are the same colour pay 5 if wheel 1 and wheel 3 are the same colour pay 5 Logic Method #2 if wheel 1 and wheel 2 are the same colour if wheel 2 and wheel 3 are the same colour pay 10 else pay 5 else if wheel 2 and wheel 3 are the same colour pay 5 if wheel 1 and wheel 3 are the same colour pay 5 |
01.0 Alice 2.x > 1.00 Alice Assignments >