10 REM Roul4 20 REM by Graham Kendall 30 : 40 GOSUB 140 : REM Init_1 Procedure 60 WHILE NEWGAME% = 0 70 GOSUB 190 :REM Call Init 2 Routine 80 GOSUB 400 :REM Call Game Routine 90 GOSUB 6000 :REM Wait for Space Routine 100 GOSUB 7000 :REM Ask Question Routine 110 WEND 120 END 130 : 140 REM Init_1 Routine 150 NEWGAME% = 0 160 DIM TABLE%(36),NUMTOBACK%(2) 165 GOSUB 290 : REM Spin Limit Procedure 170 RETURN 180 : 190 REM Init_2 Routine 200 FOR I%=0 TO 36:TABLE%(I%) = -1:NEXT 210 SEQ$ = "":WINNUMBERS$ = "Winning Numbers are - " 220 NOGAME% = 0:MONEY% = 0:TOTALWINS% = 0 230 TOTALLOSSES% = 0:TOTALBETS% = 0 240 CLS:GOSUB 6500 :REM Print Heading Routine 250 TEXT$ = "Spin Limit = " + STR$(SPINLIMIT%):DOWN% = 5:ACROSS% = 5 260 GOSUB 5500 :REM Print text on screen 270 RETURN 280 : 290 REM Spin Limit Routine 300 SPINLIMIT% = -1 310 WHILE (SPINLIMIT% <1) OR (SPINLIMIT% >20) 320 CLS 330 GOSUB 6500 :REM Print Heading Routine 340 TEXT$ = "What would you like the spin limit to be? (1 - 20)" 350 DOWN%=10:GOSUB 5000 :REM Centre Text Routine 360 INPUT SPINLIMIT% 370 WEND 380 RETURN 390 : 400 REM Game Routine 410 GOSUB 480 :REM Initial Spins Routine 420 IF NUMBEROFSPINS% <100 THEN GOSUB 610 :REM Extra Spins Routine 430 IF NUMBERSLEFT% = 2 THEN GOSUB 790:GOSUB 880:GOSUB 720 440 REM above line calls Get Numbers Routine, Wait for Numbers Routine and Bet Control Routine 450 IF TOTALBETS% = 0 THEN GOSUB 1290 :REM No Bets Routine 460 RETURN 470 : 480 REM Initial Spins Routine 490 NUMBERSLEFT% = 37:NUMBEROFSPINS% = 0 500 WHILE NUMBERSLEFT% <> 2 510 NUMBEROFSPINS% = NUMBEROFSPINS% +1 520 GOSUB 7500 : REM Get random number 530 IF TABLE%(NUM%) <> 0 THEN NUMBERSLEFT% = NUMBERSLEFT% -1:TABLE%(NUM%) = 0 540 WEND 550 TEXT$ = "Number of Initial Spins is " + STR$(NUMBEROFSPINS%):DOWN% = 7:ACROSS% = 5 560 GOSUB 5500 :REM Print text on screen 570 TEXT$ = "Numbers remaining after Initial Spins is " + STR$(NUMBERSLEFT%) 580 DOWN% = 9:ACROSS% = 5:GOSUB 5500 :REM Print text on screen 590 RETURN 600 : 610 REM Extra Spins Routine 620 TEMP% = NUMBEROFSPINS% +1 630 FOR I% = TEMP% TO 100 640 NUMBEROFSPINS% = NUMBEROFSPINS% +1 650 GOSUB 7500 : REM Get Random Number 660 IF TABLE%(NUM%) <> 0 THEN NUMBERSLEFT% = NUMBERSLEFT% -1:TABLE%(NUM%) = 0 670 NEXT I% 680 TEXT$ = "Numbers remaining after Extra Spins is " + STR$(NUMBERSLEFT%):DOWN% = 11:ACROSS% = 5 690 GOSUB 5500 :REM Print text on screen 700 RETURN 710 : 720 REM Bet Control Routine 730 WINS% = 0:PHASE% = 1 740 BET% = 1:GOSUB 980 :REM Bet Routine 750 IF WINS% = 1 THEN BET% = 2:PHASE% = 2:GOSUB 980 :REM Bet Routine 760 IF WINS% = 2 THEN BET% = 4:PHASE% = 3:GOSUB 980 :REM Bet Routine 770 RETURN 780 : 790 REM Get Numbers Routine 800 P% = 1 810 FOR I% = 0 TO 36 820 IF TABLE%(I%) = -1 THEN NUMTOBACK%(P%) = I%:P% = P% +1 830 NEXT I% 840 TEXT$ = "Numbers Left are " + STR$(NUMTOBACK%(1)) + " & " + STR$(NUMTOBACK%(2)) 850 DOWN% = 13:ACROSS% = 5:GOSUB 5500 :REM Print text on screen 860 RETURN 870 : 880 REM Wait for number Routine 890 NUM% = -1 900 WHILE NUM% <> NUMTOBACK%(1) AND NUM% <> NUMTOBACK%(2) 910 GOSUB 7500 : REM Get Random Number 920 NUMBEROFSPINS% = NUMBEROFSPINS% +1 930 WEND 940 TEXT$ = "Number that appeared is " + STR$(NUM%) + " on spin number " + STR$(NUMBEROFSPINS%) 950 DOWN% = 15:ACROSS% = 5:GOSUB 5500 :REM Print text on screen 960 RETURN 970 : 980 REM Bet Routine 990 BETSPINS% = 0 1000 TEXT$ = "Betting Phase is " + STR$(PHASE%) + " and betting " + STR$(BET%) + " units" 1010 DOWN% = 17:ACROSS% = 5:GOSUB 5500 :REM Print text on screen 1020 WHILE BETSPINS% <> SPINLIMIT% AND WINS% <> BET% 1030 TOTALBETS% = TOTALBETS% +1 1040 BETSPINS% = BETSPINS% +1 1050 GOSUB 7500 : REM Get Random Number 1060 NUMBEROFSPINS% = NUMBEROFSPINS% +1 1070 IF NUM% = NUMTOBACK%(1) OR NUM% = NUMTOBACK%(2) THEN GOSUB 1120:WINS%=BET% ELSE GOSUB 1220 1080 REM Above line calls either Win Routine or ELSE lose Routine 1090 WEND 1100 RETURN 1110 : 1120 REM Win Routine 1130 MONEY% = MONEY% - BET% 1140 MONEY% = MONEY% + BET%*35 1150 TOTALWINS% = TOTALWINS% +1 1160 WINNUMBERS$ = WINNUMBERS$ + " " + STR$(NUM%) 1170 TEXT$ = WINNUMBERS$:DOWN% = 19:ACROSS% = 5:GOSUB 5500 :REM Print Text Routine 1180 SEQ$ = SEQ$ + "W" 1190 GOSUB 1350 :REM Print Winning/Losing Sequence 1200 RETURN 1210 : 1220 REM Lose Routine 1230 MONEY% = MONEY% -(2*BET%) 1240 TOTALLOSSES% = TOTALLOSSES% +1 1250 SEQ$ = SEQ$ + "l" 1260 GOSUB 1350 :REM Print Winning/Losing Sequence 1270 RETURN 1280 : 1290 REM No Bet Routine 1300 TEXT$ = "No bets were made this time round" 1310 DOWN% = 17 1320 GOSUB 5000 : REM Centre Text Routine 1330 RETURN 1340 : 1350 REM Print Winning/Losing Sequence and Money 1360 TEXT$ = SEQ$:TEXT$ = LEFT$(TEXT$ + STRING$(70," "),70):TEXT$ = TEXT$ + STR$(MONEY%) + STRING$(3," ") 1370 DOWN% = 21:ACROSS% = 1:GOSUB 5500 :REM Print Text on Screen Routine 1380 RETURN 1390 : 5000 REM Print Centred Text Routine 5010 PRINT CHR$(11) 5020 FOR I% = 1 TO DOWN% -1:PRINT CHR$(10);:NEXT 5030 ACROSS% = (79-LEN(TEXT$))/2 5040 PRINT TAB(ACROSS%);TEXT$ 5050 RETURN 5060 : 5500 REM Print Text on Screen Routine 5510 PRINT CHR$(11) 5520 FOR I% = 1 TO DOWN% -1:PRINT CHR$(10);:NEXT 5530 PRINT TAB(ACROSS%);TEXT$ 5540 RETURN 5550 : 6000 REM Press Space Routine 6010 TEXT$ = "Press Space to Continue" 6020 DOWN% = 22:GOSUB 5000 : REM Centre Text Routine 6030 WHILE INKEY$ <> " " 6040 WEND 6050 RETURN 6060 : 6500 REM Print Heading Routine 6510 TEXT$ = "Roulette Program 4" 6520 DOWN% = 2:GOSUB 5000 : REM Centre Text Routine 6530 RETURN 6540 : 7000 REM Ask Question Routine 7010 A% = 0 7020 WHILE A% = 0:CLS:GOSUB 6500 :REM Print Heading Routine 7030 TEXT$ = "Do you want to play again?" 7040 DOWN% = 10:GOSUB 5000 :REM Centre Text Routine 7050 A$ = "" 7060 WHILE INSTR(" YyNn",A$) <2 7070 A$=INKEY$ 7080 WEND 7090 A%=INSTR("YyNn",A$) 7100 WEND 7110 IF A%=3 OR A%=4 THEN NEWGAME% = -1 7120 RETURN 7130 : 7500 REM Random Number Routine 7510 RANDOMIZE TIMER 7520 NUM% = INT(RND*(36+1)) 7530 RETURN 7540 :