!A slot machine game where you start with a given amount of money and can lose or gain money based on your luck at the slot machine. At the end
!of each game you can choose to leave the game or continue playing if you have enough money.
!List of Commands:
!Set Window Set Back Flood Let Set Color DIM Call Do Plot Text Pause Sound Input Prompt
!If-then-else Else If Print Stop For Randomize Concatenation Select Case Int Rnd End
! Total of 23 commands
SET WINDOW 0, 28, 0, 20 !Set new window
SET BACK "Black" !Set background color to Black
FLOOD 9,12 !Make background turn black
LET Greeting$= "Welcome to The Casino"
LET Game$= "The Slot Machine" !Name of the Game
SET COLOR "Cyan"
DIM v(1)
LET v(1) = 36 ! New size
CALL Object (2, 0, "font size", "", v()) !Make text change colors
DO while i<10
LET i=i+1
SET COLOR -i
PLOT TEXT, AT 10,15: Greeting$
PLOT TEXT, AT 10.5,14: Game$ ! Print name of game in different colors
PAUSE .4
SOUND (350*i),.4 ! Play a sound with each color change
LOOP
SET COLOR "White"
INPUT PROMPT "Would you like to play? Y or N":answer$
IF answer$="N" then
PRINT !If N or n then exit
PRINT
PRINT "Press any key to exit" ! Exit
STOP
ELSEIF answer$="n" then
PRINT
PRINT
PRINT "Press any key to exit" ! Exit
STOP
ELSEIF answer$="Y" then
ELSEIF answer$="y" then !If Y or y then play game
END IF
PRINT "You are going to start the game with 150 dollars!" !You start game with 150 dollars
INPUT Prompt "How much would you like to bet each game?": Bet !Ask wager per game
LET Money=150
FOR count=1 to 50 !Play up to 50 games
RANDOMIZE
LET slot1=Int[(3*rnd)+1]
LET slot2=Int[(3*rnd)+1] !Make 3 random numbers
LET slot3=Int[(3*rnd)+1]
SOUND 900,.3
SOUND 1000, .2 !Play 3 sounds
SOUND 1100,.3
SET COLOR "Magenta"
PRINT "[";slot1;"]","[";slot2;"]","[";slot3;"]" ! Print 3 random numbers
IF slot1=3 AND slot2=3 AND slot3=3 THEN ! If all 3 are 3's then add the bet to money
LET Money=Int(Money+Bet)
PRINT "You Won!" !Print You win
PRINT Money;
PRINT "dollars remaning! !" !Print new dollar amount
ELSEIF slot1=2 AND slot2=2 AND slot3=2 THEN
LET Money=Int(Money+((2*Bet)/3)) !If all 3 are 2's then add 2/3 of the bet to money
PRINT "You Won!" !Print you win
PRINT Money;
PRINT "dollars remaning! !" !Print new dollar amount
ELSEIF slot1=1 AND slot2=1 AND slot3=1 THEN
LET Money=Int(Money+(Bet/2)) !If all are 1's then add 1/2 of the bet to money
PRINT "You Won!" !Print you win
PRINT Money;
PRINT "dollars remaning! !" !Print new dollar amount
ELSE
LET Money=Int(Money-Bet) !If none match then subtract the bet from money
PRINT "YOU HAVE LOST!" !Print you lose
PRINT Money; "dollars remaning!" !Print new dollar amount
END IF
SET COLOR "white"
IF Money = 0 then !If money equals 0 then can no longer play
PRINT "You are out of money, YOU LOSE!"
PRINT
PRINT
PRINT "Press any key to exit" !You lose, exit
STOP
ELSEIF Money < Bet then !If your dollar amount is less than your bet, then you cant continue
PRINT "You have too little money continue, sorry."
PRINT
PRINT
PRINT "Press any key to exit" !exit
STOP
END IF
INPUT prompt "Would you like to play again? 1 = YES & 2 = NO": newgame !Ask to play another game
SELECT CASE newgame ! If no, then exit
CASE 2
PRINT
PRINT
PRINT "Press any key to exit" !Exit
STOP
CASE 1 !If yes then prepare for new game
PRINT
PRINT "You now have";Money;" dollars!" !Print new dollar amount for start of next game
PRINT
END SELECT
NEXT count !Start next game
END