home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG055.ARC
/
POKER.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
12KB
|
403 lines
54 'Poker Machine Simulation
55 BEL$ = CHR$(7):'Bell
58 BS$ = CHR$(8):' Backspace
61 HT$ = CHR$(9):'Horizontal tab
64 LF$ = CHR$(10):'Line feed
67 VT$ = CHR$(11):'Vert tab
70 FF$ = CHR$(12):'Form feed
73 RET$ = CHR$(13):'Carriage return
76 ESC$ = CHR$(27):'Escape
79 HOME$ = CHR$(17):'Cursor home
82 NL$ = ESC$+"R":'Clear line
84 SP$ = CHR$(32):'Space
85 TURN=0
86 '
87 ' ------ DYNAMIC VIDEO ATTRIBUTE CONTROL STRINGS ------
88 '
94 STDVID$ =ESC$+"K":'Normal Video
111 '
113 REVSTD$ = ESC$+"J":'Inverse Video
128 ' ------ DYNAMIC EDITING CONTROL STRINGS ------
129 '
135 CLRSCRN$ = CHR$(12)
185 ' ----------------- SCREEN ADDRESSES ------------------
186 '
187 LHS% = 1
188 RHS% = 64
189 TOP% = 1
190 BOTTOM% = 30
193 '
194 ' Definition of CURSOR LOAD Function.
195 DEF FNCSRLD$(ROW%,COLUMN%) = ESC$+"="+CHR$(ROW%+31)+CHR$(COLUMN%+31)
200 '
201 ' ------ FORMAT CONTROL OPERATION STRINGS ------
202 '
1000 DIM PRESREEL(3,3):'Reels are displayed(3 rows x 3 columns)
1050 DIM REEL(3,20):'Reel Combinations
1100 '
1150 '
1200 '******* INITIALISE DATA ********
1250 '
1300 STARTROW% = TOP%+6
1350 NUMOFREELS% = 3
1400 '
1450 PRINT CLRSCRN$
1500 PRINT TAB(24)"JACKPOT GAME":PRINT
1550 PRINT"Do you want to see the payouts ..... <Y>es or any key ";
1600 A$=INKEY$:IF A$="" THEN 1600
1650 IF A$="Y" THEN 1700 ELSE 2400
1700 PRINT CLRSCRN$
1725 PRINT TAB(24)"JACKPOT GAME":PRINT
1730 PRINT"You start the game with $15 each turn costs $1":PRINT
1740 PRINT TAB(10)"The rest is up to you and luck":PRINT:PRINT
1750 PRINT "REEL 1" ,"REEL 2" ,"REEL 3" ,"PAYOFF $":PRINT
1800 '
1850 PRINT "NINE" ,"ANYTHING" ,"ANYTHING" ,"3"
1900 PRINT "NINE" ,"NINE" ,"ANYTHING" ,"5"
1950 PRINT "JACK" ,"JACK" ,"ACE" ,"6"
2000 PRINT "KING" ,"KING" ,"JACK" ,"8"
2050 PRINT "TEN" ,"TEN" ,"TEN" ,"10"
2150 PRINT "JACK" ,"JACK" ,"JACK" ,"18"
2200 PRINT "QUEEN" ,"QUEEN" ,"QUEEN" ,"20"
2250 PRINT "KING" ,"KING" ,"KING" ,"30"
2300 PRINT "ACE" ,"ACE" ,"ACE" ,"200"
2350 '
2400 FOR POSITION% = 1 TO NUMOFREELS%
2450 COLOFFSET%(POSITION%) = LHS%+OFFSET%
2500 OFFSET% = OFFSET%+14
2550 NEXT POSITION%
2600 FOR DISPLAYREEL% = 1 TO 6
2650 FOR SEG% = 1 TO 5
2700 READ REEL$(DISPLAYREEL%,SEG%)
2750 NEXT SEG%
2800 NEXT DISPLAYREEL%
2850 PRINT:PRINT
2900 INPUT"Input number (Range -32766 to 32767) to start ..... ";A
3000 RANDOMIZE(A)
3050 FOR CARD% = 1 TO 20
3100 FOR COLUMN% = 1 TO 3
3150 READ REEL(COLUMN%,CARD%)
3200 NEXT COLUMN%
3250 NEXT CARD%
3300 YOURCASH = 14
3350 PRINT CLRSCRN$
3351 PRINT" ";REVSTD$;" JACKPOT GAME ";STDVID$
3400 '>>>>>>> LOOP RE-ENTRY POINT
3402 TURN=TURN+1
3405 PRINT ESC$+"Y"
3410 PRINT FNCSRLD$(TOP%+4,55);NL$;
3420 PRINT USING "$$#####-";YOURCASH
3425 PRINT FNCSRLD$(TOP%+5,57);"credit"
3500 PRINT FNCSRLD$(TOP%+15,LHS%);"PAY ------"
3505 PRINT FNCSRLD$(TOP%+15,LHS%+51);"------ LINE"
3506 PRINT FNCSRLD$(TOP%+15,LHS%+22);"---"
3507 PRINT FNCSRLD$(TOP%+15,LHS%+36);"---"
3550 FOR COLUMN% = 1 TO 3
3600 RANDOMCARD% = INT(20*RND+1)
3650 ' Check for boundary condition, CARD%=1
3700 IF RANDOMCARD% = 1
THEN
PRESREEL (1,COLUMN%) = REEL(COLUMN%,20):
GOTO 3800
3750 PRESREEL (1,COLUMN%) = REEL(COLUMN%,RANDOMCARD%-1)
3800 PRESREEL(2,COLUMN%) = REEL(COLUMN%,RANDOMCARD%)
3850 ' Check for boundary condition, CARD%=20
3900 IF RANDOMCARD% = 20
THEN
PRESREEL (3,COLUMN%) = REEL(COLUMN%,1):
GOTO 4000
3950 PRESREEL (3,COLUMN%) = REEL(COLUMN%,RANDOMCARD%+1)
4000 GOSUB 5550
4050 NEXT COLUMN%
4100 WINNINGS = 0 : BELLON$ = ""
4110 '
4120 'The following IF THEN statements check for winning combinations
4130 '
4150 IF PRESREEL(2,1) <> 4
THEN
4300
ELSE
IF PRESREEL(2,2) <> 4
THEN
4900
4200 IF PRESREEL(2,3) = 4
THEN
4250
ELSE
IF PRESREEL(2,3) <> 2
THEN
4900
ELSE
WINNINGS = 8 :
BELLON$ = BEL$ :
GOTO 4900
4250 WINNINGS = 30 :
BELLON$ = BEL$ :
GOTO 4900
4300 IF PRESREEL(2,1) <> 5
THEN
4400
ELSE
IF PRESREEL(2,2) <> 5
THEN
4900
ELSE
IF PRESREEL(2,3) <> 5
THEN
4900
4350 WINNINGS = 10 :
BELLON$ = BEL$ :
GOTO 4900
4400 IF PRESREEL(2,1) <> 3
THEN
4500
ELSE
IF PRESREEL(2,2) <> 3
THEN
4900
ELSE
IF PRESREEL(2,3) <> 3
THEN
4900
4450 WINNINGS = 200 :
BELLON$ = BEL$ :
GOTO 4900
4500 IF PRESREEL(2,1) <> 1
THEN
4600
ELSE
IF PRESREEL(2,2) = 1
THEN
4550
ELSE
WINNINGS = 3 :
BELLON$ = BEL$ :
GOTO 4900
4550 WINNINGS = 5 :
BELLON$ = BEL$ :
GOTO 4900
4600 IF PRESREEL(2,1) <> 2
THEN
4750
ELSE
IF PRESREEL(2,2) <> 2
THEN
4900
ELSE
IF PRESREEL(2,3) = 3
THEN
4700
4650 IF PRESREEL(2,3) <> 2
THEN
4900
ELSE
WINNINGS = 18 :
BELLON$ = BEL$ :
GOTO 4900
4700 WINNINGS = 6 :
BELLON$ = BEL$ :
GOTO 4900
4750 IF PRESREEL(2,1) <> 6
THEN
4900
ELSE
IF PRESREEL(2,2) <> 6
THEN
4900
ELSE
IF PRESREEL(2,3) = 3
THEN
4850
4800 IF PRESREEL(2,3) <> 6
THEN
4900
ELSE
WINNINGS = 20 :
BELLON$ = BEL$ :
GOTO 4900
4850 WINNINGS = 15 :
BELLON$ = BEL$
4900 IF WINNINGS = 200 THEN GOSUB 6050:PRINT FNCSRLD$(TOP%+5,20);"***** JACKPOT *****"
4950 IF BELLON$ = BEL$
THEN
GOSUB 6050
5100 PRINT FNCSRLD$(TOP%+4,LHS%+11);"To 'PLAY' hit any key, else 'N' to quit ";
5150 A$=INKEY$:IF A$="" THEN 5150
5160 YOURCASH = YOURCASH-1
5200 IF A$ = "N"
THEN
5250
ELSE
3400
5250 IF YOURCASH < 15 THEN 5350
5255 PRINT CHR$(12):PRINT
5260 PRINT"CONGRATULATIONS ..... you won ";YOURCASH-14;" Dollars in ";TURN;" turns":PRINT
5300 GOTO 10250
5350 IF YOURCASH < 0 THEN 5390
5360 PRINT CHR$(12)
5370 PRINT"Too bad you LOST ";14-YOURCASH ;" Dollars"
5380 GOTO 5460
5390 PRINT CHR$(12):PRINT
5400 PRINT "YOU HAVE TEN DAYS TO PAY ME THE $";15-YOURCASH;" AFTER THAT"
5450 PRINT "IT IS OUT OF MY HANDS AS TO WHAT HAPPENS TO YOU !!!"
5460 PRINT:PRINT"All of this loss took you ";TURN;" turns":PRINT
5500 GOTO 10250
5550 IF PRESREEL(2,COLUMN%) = 1
THEN
GOSUB 6650 : RETURN
5600 IF PRESREEL(2,COLUMN%) = 2
THEN
GOSUB 6650 : RETURN
5650 IF PRESREEL(2,COLUMN%) = 3
THEN
GOSUB 6650 : RETURN
5700 IF PRESREEL(2,COLUMN%) = 4
THEN
GOSUB 6650 : RETURN
5750 IF PRESREEL(2,COLUMN%) = 5
THEN
GOSUB 6650 : RETURN
5800 PRESREEL(2,COLUMN%) = 6
5850 GOSUB 6650
5900 RETURN
5950 '
6000 '----------------------------------------------------------------------
6050 ' Subroutine [1]: DING BELL & INCREMENT EARNINGS
6100 '
6150 FOR LOOP = 1 TO WINNINGS
6200 PRINT BEL$;
6205 FOR D= 1 TO 30:NEXT D
6210 YOURCASH = YOURCASH+1
6215 PRINT FNCSRLD$(TOP%+27,30);"WIN"
6220 PRINT FNCSRLD$(TOP%+4,55);NL$;
6230 PRINT USING "$$#####-";YOURCASH
6400 NEXT LOOP
6450 RETURN
6500 '
6550 '----------------------------------------------------------------------
6600 '
6650 ' Subroutine [2]: PRINT REELS
6700 '
6750 '
6800 PRINTROW% = STARTROW%
6850 FOR ROW% = 1 TO 3
6900 FOR SEG% = 1 TO 5
6950 PRINT FNCSRLD$
(PRINTROW%+SEG%,COLOFFSET%(COLUMN%)+12);
REVSTD$;
REEL$(PRESREEL(ROW%,COLUMN%),SEG%);
STDVID$
7000 NEXT SEG%
7050 PRINTROW% = PRINTROW%+6
7100 NEXT ROW%
7150 PRINT HOME$
7200 RETURN
7250 '
7300 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7350 '
7400 ' REEL DISPLAY DATA
7450 '
7500 DATA "999999999"
7550 DATA "9 9"
7600 DATA " N I N E "
7650 DATA "9 9"
7700 DATA "999999999"
7750 DATA "JJJJJJJJJ"
7800 DATA "J J"
7850 DATA " J A C K "
7900 DATA "J J"
7950 DATA "JJJJJJJJJ"
8000 DATA " * "
8050 DATA " * * "
8100 DATA " A C E "
8150 DATA " ******* "
8200 DATA "* *"
8250 DATA "KKKKKKKKK"
8300 DATA "K\\\ ///K"
8350 DATA " K I N G "
8400 DATA "K/// \\\K"
8450 DATA "KKKKKKKKK"
8500 DATA "10 10"
8550 DATA " T "
8600 DATA " T E N "
8650 DATA " N "
8700 DATA "10 10"
8750 DATA "QQQQQQQQQ"
8800 DATA "Q-------Q"
8850 DATA "Q U E E N"
8900 DATA "Q-------Q"
8950 DATA "QQQQQQQQQ"
9000 '
9050 ' REEL COMBINATION DATA
9100 '
9110 ' This data is sequence the cards appear on each reel these are NOT
9120 ' the winning combinations, they are determined in the programme by
9130 ' the IF THEN statements so marked.
9131 '
9150 ' REEL 1, REEL 2, REEL 3
9200 '
9249 ' JACK KING JACK
9250 DATA 2, 4, 2
9251 '
9299 ' TEN NINE KING
9300 DATA 5, 1, 4
9301 '
9349 ' JACK JACK TEN
9350 DATA 2, 2, 5
9351 '
9399 ' QUEEN KING QUEEN
9400 DATA 6, 4, 6
9401 '
9449 ' NINE NINE JACK
9450 DATA 1, 1, 2
9451 '
9499 ' KING JACK QUEEN
9500 DATA 4, 2, 6
9501 '
9549 ' TEN KING TEN
9550 DATA 5, 4, 5
9551 '
9599 ' QUEEEN NINE KING
9600 DATA 6, 1, 4
9601 '
9649 ' KING TEN ***ACE***
9650 DATA 4, 5, 3
9651 '
9699 ' TEN TEN TEN
9700 DATA 5, 5, 5
9701 '
9749 ' NINE NINE JACK
9750 DATA 1, 1, 2
9751 '
9799 ' JACK JACK KING
9800 DATA 2, 2, 4
9801 '
9849 ' KING KING QUEEN
9850 DATA 4, 4, 6
9851 '
9899 ' NINE ***ACE*** JACK
9900 DATA 1, 3, 2
9901 '
9949 ' ***ACE*** KING JACK
9950 DATA 3, 4, 2
9951 '
9999 ' JACK NINE KING
10000 DATA 2, 1, 4
10001 '
10049 ' QUEEN JACK TEN
10050 DATA 6, 2, 5
10051 '
10099 ' NINE KING JACK
10100 DATA 1, 4, 2
10101 '
10149 ' KING QUEEN KING
10150 DATA 4, 6, 4
10151 '
10199 ' JACK NINE JACK
10200 DATA 2, 1, 2
10201 '
10250 END
6, 4
10151 '
10199 ' JACK NINE JACK
10200 DATA