'Casino slot machine ' 'This program lets you play a simplified computerized slot 'machine and keeps track of your winnings and your losses! DECLARE SUB dowinsound () DECLARE SUB finalspin (money!) DECLARE SUB spinreels () DECLARE SUB drawcherry (colpos%, rowpos%) DECLARE SUB drawplum (colpos%, rowpos%) DECLARE SUB drawbar (colpos%, rowpos%) GOSUB titlescreen GOSUB getbetamt DO WHILE (money > 0) 200 PRINT IF money >= 1000 AND money < 10000 THEN PRINT USING "&$#,###.##&"; "You have: "; money; " to bet." ELSEIF money >= 10000 AND money < 100000 THEN PRINT USING "&$##,###.##&"; "You have: "; money; " to bet." ELSEIF money < 1000 THEN PRINT USING "&$###.##&"; "You have: "; money; " to bet." ELSEIF money > 100000 AND money < 1000000 THEN PRINT USING "&$###,###.##&"; "You have: "; money; " to bet." ELSE PRINT USING "&$##,###,###.##&"; "You have: "; money; " to bet." END IF PRINT "Press ENTER to drop a quarter and pull the handle" INPUT "(Input STOP to quit the game or PAY to see payoffs)"; ent$ IF (UCASE$(LEFT$(ent$, 1)) = "S") THEN EXIT DO ELSEIF (UCASE$(LEFT$(ent$, 1)) = "P") THEN CLS GOSUB titlescreen x = 1 GOSUB getbetamt CLS GOTO 200 END IF GOSUB setupnewgame CALL spinreels CALL finalspin(money) LOOP CLS GOSUB finalmessage END titlescreen: SCREEN 9 COLOR 15, 1 PRINT "Casino Action !!!" PRINT "------" PRINT PRINT "Welcome to the slotgame of the century!" PRINT PRINT "This game lets you continue playing until you are" PRINT "ready to stop or until you are out of money." PRINT PRINT "Each spin costs you a quarter. Here are the payoffs:" PRINT PRINT "3 bars : $6.00" CALL drawbar(140, 130) CALL drawbar(270, 130) CALL drawbar(400, 130) PRINT PRINT COLOR 15, 1 PRINT "3 plums : $4.00" PRINT PRINT CALL drawplum(140, 170) CALL drawplum(270, 170) CALL drawplum(400, 170) COLOR 15, 1 PRINT "3 cherries : $5.00" PRINT CALL drawcherry(140, 220) CALL drawcherry(270, 220) CALL drawcherry(400, 220) RETURN getbetamt: PRINT "Remember, this is only a game. No wagering for real" PRINT "(unless you want to win a LOT of CASHola!)" PRINT PRINT "<>" DO: LOOP WHILE INKEY$ = "" IF x = 1 THEN RETURN CLS 114 RETURN setupnewgame: RANDOMIZE TIMER money = money - .25 numbars = 0 numplums = 0 numcherries = 0 RETURN finalmessage: IF money <= 0 THEN PRINT "Too Bad. Hope you have a ticket home." PRINT "Come back when you've got more money." ELSE PRINT "You are leaving with money, which is more than" PRINT "I can say for a lot of people! Good-Bye!" END IF END SUB dowinsound FOR tone = 1000 TO 10000 STEP 450 SOUND tone, 1 NEXT tone END SUB SUB drawbar (colpos%, rowpos%) LINE (colpos%, rowpos%)-(colpos% + 80, rowpos% + 30), 14, B PAINT (colpos% + 1, rowpos% + 1), 14, 14 COLOR 15, 1 END SUB SUB drawcherry (colpos%, rowpos%) 'adjust for cherry's shape colpos% = colpos% + 35 rowpos% = rowpos% + 10 'cherry outline CIRCLE (colpos%, rowpos%), 6, 4 CIRCLE (colpos% - 7, rowpos% + 3), 6, 4 CIRCLE (colpos% - 1, rowpos% + 6), 6, 4 'red color PAINT (colpos% + 1, rowpos%), 4, 4 PAINT (colpos% - 7, rowpos% + 3), 4, 4 PAINT (colpos%, rowpos% + 6), 4, 4 'stem LINE (colpos%, rowpos% + 2)-(colpos% + 20, rowpos% + 4), 4, B PAINT (colpos% + 19, rowpos% + 3), 2, 4 END SUB SUB drawplum (colpos%, rowpos%) 'adjust for plum shape colpos% = colpos% + 20 rowpos% = rowpos% + 20 CIRCLE (colpos% + 19, rowpos% - 5), 18, 13 PAINT (colpos% + 19, rowpos% - 5), 13, 13 LINE (colpos% + 37, rowpos%)-(colpos% + 39, rowpos% + 2), 6 PSET (colpos% + 19, rowpos% - 9), 0 PSET (colpos% + 24, rowpos% - 8), 0 PSET (colpos% + 27, rowpos% - 6), 0 PSET (colpos% + 25, rowpos% - 4), 0 END SUB SUB finalspin (money) CLS COLOR 15, 1 FOR i = 1 TO 3 n = INT(3 * RND) + 1 SELECT CASE n CASE 1 CALL drawbar(i * 130, 130) numbars = numbars + 1 CASE 2 CALL drawplum(i * 130, 130) numplums = numplums + 1 CASE 3 CALL drawcherry(i * 130, 130) numcherries = numcherries + 1 END SELECT NEXT i IF numbars = 3 THEN CALL dowinsound PRINT "Three bars! You win $6.00!!" money = money + 6! ELSEIF numplums = 3 THEN CALL dowinsound PRINT "Three plums! You win $4.00!!" money = money + 4 ELSEIF numcherries = 3 THEN CALL dowinsound PRINT "Three cherries! You win $5.00!!" money = money + 5! END IF END SUB SUB spinreels FOR spin = 1 TO 3 CALL drawplum(130, 130) CALL drawcherry(260, 130) CALL drawbar(390, 130) SOUND INT(RND * 8000) + 37, 1.82 CLS COLOR 15, 1 CALL drawplum(390, 130) CALL drawcherry(130, 130) CALL drawbar(260, 130) SOUND INT(RND * 8000) + 37, 1.82 CLS COLOR 15, 1 CALL drawplum(260, 130) CALL drawcherry(390, 130) CALL drawbar(130, 130) SOUND INT(RND * 8000) + 37, 1.82 CLS COLOR 15, 1 NEXT spin END SUB