home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
snug
/
Blackjak.txt
< prev
next >
Wrap
Text File
|
2006-10-19
|
6KB
|
140 lines
100 REM BLACKJACK
110 REM BY WALID MAALOULI
120 REM NOVEMBER 2001
130 DIM C$(12)
140 DIM C(36,3)
150 FOR I=0 TO 12:READ C$(I):NEXT I
160 DATA "A","2","3","4","5","6","7","8","9","10","J","Q","K"
170 CALL CHAR(0,"040E1F1F0E0404")
180 CALL CHAR(1,"0E0E1F1F0E0E0404")
190 CALL CHAR(2,"040E1F0E04")
200 CALL CHAR(3,"0A1F1F0E0E04")
210 DISPLAY BEEP,"Do you need instructions? (Y/N)";
220 A$=KEY$:IF A$="Y"OR A$="y"THEN GOSUB 1070
230 RANDOMIZE
240 MONEY=100
250 DISPLAY AT(1),"You have $";MONEY;": Min. bid $10.":PAUSE
260 DISPLAY BEEP,"Enter bet <ENTER>=10:";
270 ACCEPT AT(24)VALIDATE(DIGIT)NULL(10) SIZE(-4),BET
280 IF (BET>MONEY)OR (BET<10)OR (INT(BET/10)<>BET/10)THEN 270
290 MONEY=MONEY-BET
300 FOR I=1 TO 2
310 GOSUB 780
320 DVAL=DVAL+CVAL
330 IF ACEFLAG=1 THEN DACE=DACE+1:ACEFLAG=0
340 DEALER$=DEALER$&CHR$(SI)&C$(S)&" "
350 NEXT I
360 DISPLAY ERASE ALL BEEP,"Dealer has ";CHR$(SI);C$(S);" showing...":PAUSE
370 IF DVAL=21 THEN 380 ELSE 410
380 IF SEG$(DEALER$,2,1)="1" THEN 410
390 IF SEG$(DEALER$,5,1)="1" THEN 410
400 DISPLAY BEEP,"Dealer has BLACKJACK!":PAUSE 1
405 DISPLAY ERASE ALL,"Dealer has ";DEALER$;" =";DVAL:PAUSE 1
406 GOTO 470
410 GOSUB 780
420 PLAYER$=PLAYER$&CHR$(SI)&C$(S)&" "
430 IF ACEFLAG=1 THEN PACE=PACE+1:ACEFLAG=0
440 PVAL=PVAL+CVAL:CARDNUM=CARDNUM+1
450 DISPLAY BEEP,"You have: ";PLAYER$;" =";PVAL
460 IF PVAL>21 AND PACE=0 THEN 470 ELSE 560
470 PAUSE 1:DISPLAY BEEP ERASE ALL,"You are BUSTED!!!":PAUSE 2
480 PRINT "PLAY AGAIN? (Y/N)"
490 A$=KEY$:IF A$="N" OR A$="n" THEN STOP
500 IF MONEY<10 THEN MONEY=100 ELSE GOTO 520
510 DISPLAY BEEP,"Making a trip to the ATM...":PAUSE
520 ACEFLAG=0:DFLAG=0:CARDNUM=0:PVAL=0:DVAL=0:PLAYER$="":DEALER$=""
530 DACE=0:PACE=0
540 IF CARDCOUNT>=141 THEN GOSUB 980
550 GOTO 250
560 IF PVAL>21 AND PACE>0 THEN PVAL=PVAL-10:PACE=PACE-1:GOTO 450
570 IF PVAL=21 AND CARDNUM=2 THEN 580 ELSE 620
580 IF SEG$(PLAYER$,2,1)="1"THEN 620
590 IF SEG$(PLAYER$,5,1)="1"THEN 620
600 PAUSE 1:DISPLAY BEEP,"You have BLACKJACK!!!":PAUSE 1
610 MONEY=MONEY+BET*2.5:GOTO 480
620 A$=KEY$
630 IF (A$="H"OR A$="h")AND DFLAG=0 THEN 410
640 IF (A$="D"OR A$="d") AND DFLAG=0 THEN DFLAG=1 ELSE 660
650 MONEY=MONEY-BET:BET=BET*2:GOTO 410
660 IF A$="S"OR A$="s"THEN 670 ELSE 620
670 DISPLAY BEEP,"Dealer: ";DEALER$;" =";DVAL:PAUSE 1
680 IF DVAL>=17 THEN 710
690 GOSUB 780
700 DVAL=DVAL+CVAL:DEALER$=DEALER$&CHR$(SI)&C$(S)&" ":GOTO 670
710 IF DVAL>21 AND DACE>0 THEN DACE=DACE-1:DVAL=DVAL-10:GOTO 670
720 IF DVAL=PVAL THEN MONEY=MONEY+BET ELSE 740
730 DISPLAY BEEP,"You are even with the house...":PAUSE 2:GOTO 480
740 IF (DVAL>PVAL)AND DVAL<22 THEN DISPLAY BEEP,"House wins!":PAUSE 2:GOTO 480
750 IF DVAL<PVAL THEN MONEY=MONEY+BET*2 ELSE 770
760 DISPLAY BEEP,"You beat the house!!!":PAUSE 2:GOTO 480
770 IF DVAL>21 THEN MONEY=MONEY+BET*2:GOTO 760
780 REM CARD DISTRIBUTION ROUTINE
790 CARDCOUNT=CARDCOUNT+1
800 CI=INTRND(37)-1:SI=INTRND(4)-1
810 IF C(CI,SI)=1 THEN 800
820 C(CI,SI)=1
830 IF CI<13 THEN S=CI
840 IF CI>12 AND CI<25 THEN S=CI-13 ELSE CI=CI-26
850 IF C$(S)="J"OR C$(S)="Q"OR C$(S)="K"THEN CVAL=10:RETURN
860 IF C$(S)="A"THEN ACEFLAG=1:CVAL=11:RETURN
870 CVAL=VAL(C$(S))
880 RETURN
980 DECKS RESHUFFLING ROUTINE
990 DISPLAY BEEP,"Reshuffling the decks...":PAUSE 1
1000 FOR I=0 TO 36
1010 FOR J=0 TO 3
1020 C(I,J)=0
1030 NEXT J
1040 NEXT I
1050 CARDCOUNT=0
1060 RETURN
1070 REM INSTRUCTIONS
1080 PRINT:PRINT "This is a game of classic":PAUSE
1090 PRINT "Blackjack. The game uses 3":PAUSE
1100 PRINT "decks of cards for drawing.":PAUSE
1110 PRINT "After making your bet in":PAUSE
1120 PRINT "multiples of $10, the dealer":PAUSE
1130 PRINT "is dealt 2 cards, of which":PAUSE
1140 PRINT "only the top card is visible.":PAUSE
1150 PRINT "If the dealer draws Blackjack":PAUSE
1160 PRINT "(Ace and either a J, Q or K),":PAUSE
1170 PRINT "then you lose your bet.":PAUSE
1180 PRINT "Otherwise, you will be dealt":PAUSE
1190 PRINT "one card, following":PAUSE
1200 PRINT "which you will need to decide":PAUSE
1210 PRINT "whether you want to hit (H),":PAUSE
1220 PRINT "double (D), or stay (S). If":PAUSE
1230 PRINT "you hit, then you will be":PAUSE
1240 PRINT "dealt another card.":PAUSE
1250 PRINT "You can choose to double, at":PAUSE
1270 PRINT "which time your bet will be":PAUSE
1280 PRINT "doubled. Then, you will be":PAUSE
1290 PRINT "dealt only ONE more card and":PAUSE
1300 PRINT "no further hits will be":PAUSE
1310 PRINT "allowed. Once you stay, then":PAUSE
1320 PRINT "the dealer will start drawing":PAUSE
1330 PRINT "cards until the total is 17":PAUSE
1340 PRINT "or the dealer busts. Busting":PAUSE
1350 PRINT "for the player or dealer":PAUSE
1360 PRINT "occurs when the total is over":PAUSE
1370 PRINT "21. If the dealer busts or":PAUSE
1380 PRINT "has a total less than the":PAUSE
1390 PRINT "player, then the player wins":PAUSE
1400 PRINT "2 times the current bet.":PAUSE
1401 PRINT "If the player has blackjack,":PAUSE
1402 PRINT "then he/she wins 2 1/2 times":PAUSE
1403 PRINT "the amount of the bet.":PAUSE
1410 PRINT "If the dealer and player are":PAUSE
1420 PRINT "equal, then the bet is returned":PAUSE
1430 PRINT "to the player. Otherwise, the":PAUSE
1440 PRINT "bet is lost. In any case, the":PAUSE
1450 PRINT "player may play again. If no":PAUSE
1460 PRINT "money is left, then the player":PAUSE
1470 PRINT "makes a trip to the ATM for":PAUSE
1480 PRINT "more money...":PAUSE
1490 PRINT "Card values are as follows:":PAUSE
1500 PRINT "A is 11 or 1, J, Q, & K are":PAUSE
1510 PRINT "10, and the rest are at face":PAUSE
1520 PRINT "value.":PAUSE
1490 PRINT "Have fun!":PAUSE:RETURN