home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / snug / Blackjak.txt < prev    next >
Text File  |  2006-10-19  |  6KB  |  140 lines

  1. 100 REM BLACKJACK
  2. 110 REM BY WALID MAALOULI
  3. 120 REM NOVEMBER 2001
  4. 130 DIM C$(12)
  5. 140 DIM C(36,3)
  6. 150 FOR I=0 TO 12:READ C$(I):NEXT I
  7. 160 DATA "A","2","3","4","5","6","7","8","9","10","J","Q","K"
  8. 170 CALL CHAR(0,"040E1F1F0E0404")
  9. 180 CALL CHAR(1,"0E0E1F1F0E0E0404")
  10. 190 CALL CHAR(2,"040E1F0E04")
  11. 200 CALL CHAR(3,"0A1F1F0E0E04")
  12. 210 DISPLAY BEEP,"Do you need instructions? (Y/N)";
  13. 220 A$=KEY$:IF A$="Y"OR A$="y"THEN GOSUB 1070
  14. 230 RANDOMIZE
  15. 240 MONEY=100
  16. 250 DISPLAY AT(1),"You have $";MONEY;": Min. bid $10.":PAUSE
  17. 260 DISPLAY BEEP,"Enter bet <ENTER>=10:";
  18. 270 ACCEPT AT(24)VALIDATE(DIGIT)NULL(10) SIZE(-4),BET
  19. 280 IF (BET>MONEY)OR (BET<10)OR (INT(BET/10)<>BET/10)THEN 270
  20. 290 MONEY=MONEY-BET
  21. 300 FOR I=1 TO 2
  22. 310 GOSUB 780
  23. 320 DVAL=DVAL+CVAL
  24. 330 IF ACEFLAG=1 THEN DACE=DACE+1:ACEFLAG=0
  25. 340 DEALER$=DEALER$&CHR$(SI)&C$(S)&" "
  26. 350 NEXT I
  27. 360 DISPLAY ERASE ALL BEEP,"Dealer has ";CHR$(SI);C$(S);" showing...":PAUSE
  28. 370 IF DVAL=21 THEN 380 ELSE 410
  29. 380 IF SEG$(DEALER$,2,1)="1" THEN 410
  30. 390 IF SEG$(DEALER$,5,1)="1" THEN 410
  31. 400 DISPLAY BEEP,"Dealer has BLACKJACK!":PAUSE 1
  32. 405 DISPLAY ERASE ALL,"Dealer has ";DEALER$;" =";DVAL:PAUSE 1
  33. 406 GOTO 470 
  34. 410 GOSUB 780
  35. 420 PLAYER$=PLAYER$&CHR$(SI)&C$(S)&" "
  36. 430 IF ACEFLAG=1 THEN PACE=PACE+1:ACEFLAG=0
  37. 440 PVAL=PVAL+CVAL:CARDNUM=CARDNUM+1
  38. 450 DISPLAY BEEP,"You have: ";PLAYER$;" =";PVAL
  39. 460 IF PVAL>21 AND PACE=0 THEN 470 ELSE 560
  40. 470 PAUSE 1:DISPLAY BEEP ERASE ALL,"You are BUSTED!!!":PAUSE 2
  41. 480 PRINT "PLAY AGAIN? (Y/N)"
  42. 490 A$=KEY$:IF A$="N" OR A$="n" THEN STOP
  43. 500 IF MONEY<10 THEN MONEY=100 ELSE GOTO 520
  44. 510 DISPLAY BEEP,"Making a trip to the ATM...":PAUSE
  45. 520 ACEFLAG=0:DFLAG=0:CARDNUM=0:PVAL=0:DVAL=0:PLAYER$="":DEALER$=""
  46. 530 DACE=0:PACE=0
  47. 540 IF CARDCOUNT>=141 THEN GOSUB 980
  48. 550 GOTO 250
  49. 560 IF PVAL>21 AND PACE>0 THEN PVAL=PVAL-10:PACE=PACE-1:GOTO 450
  50. 570 IF PVAL=21 AND CARDNUM=2 THEN 580 ELSE 620
  51. 580 IF SEG$(PLAYER$,2,1)="1"THEN 620
  52. 590 IF SEG$(PLAYER$,5,1)="1"THEN 620
  53. 600 PAUSE 1:DISPLAY BEEP,"You have BLACKJACK!!!":PAUSE 1
  54. 610 MONEY=MONEY+BET*2.5:GOTO 480
  55. 620 A$=KEY$
  56. 630 IF (A$="H"OR A$="h")AND DFLAG=0 THEN 410
  57. 640 IF (A$="D"OR A$="d") AND DFLAG=0 THEN DFLAG=1 ELSE 660
  58. 650 MONEY=MONEY-BET:BET=BET*2:GOTO 410
  59. 660 IF A$="S"OR A$="s"THEN 670 ELSE 620
  60. 670 DISPLAY BEEP,"Dealer: ";DEALER$;" =";DVAL:PAUSE 1
  61. 680 IF DVAL>=17 THEN 710
  62. 690 GOSUB 780
  63. 700 DVAL=DVAL+CVAL:DEALER$=DEALER$&CHR$(SI)&C$(S)&" ":GOTO 670
  64. 710 IF DVAL>21 AND DACE>0 THEN DACE=DACE-1:DVAL=DVAL-10:GOTO 670
  65. 720 IF DVAL=PVAL THEN MONEY=MONEY+BET ELSE 740
  66. 730 DISPLAY BEEP,"You are even with the house...":PAUSE 2:GOTO 480
  67. 740 IF (DVAL>PVAL)AND DVAL<22 THEN DISPLAY BEEP,"House wins!":PAUSE 2:GOTO 480
  68. 750 IF DVAL<PVAL THEN MONEY=MONEY+BET*2 ELSE 770
  69. 760 DISPLAY BEEP,"You beat the house!!!":PAUSE 2:GOTO 480
  70. 770 IF DVAL>21 THEN MONEY=MONEY+BET*2:GOTO 760
  71. 780 REM CARD DISTRIBUTION ROUTINE
  72. 790 CARDCOUNT=CARDCOUNT+1
  73. 800 CI=INTRND(37)-1:SI=INTRND(4)-1
  74. 810 IF C(CI,SI)=1 THEN 800
  75. 820 C(CI,SI)=1
  76. 830 IF CI<13 THEN S=CI
  77. 840 IF CI>12 AND CI<25 THEN S=CI-13 ELSE CI=CI-26
  78. 850 IF C$(S)="J"OR C$(S)="Q"OR C$(S)="K"THEN CVAL=10:RETURN
  79. 860 IF C$(S)="A"THEN ACEFLAG=1:CVAL=11:RETURN
  80. 870 CVAL=VAL(C$(S))
  81. 880 RETURN
  82. 980 DECKS RESHUFFLING ROUTINE
  83. 990 DISPLAY BEEP,"Reshuffling the decks...":PAUSE 1
  84. 1000 FOR I=0 TO 36
  85. 1010 FOR J=0 TO 3
  86. 1020 C(I,J)=0
  87. 1030 NEXT J
  88. 1040 NEXT I
  89. 1050 CARDCOUNT=0
  90. 1060 RETURN
  91. 1070 REM INSTRUCTIONS
  92. 1080 PRINT:PRINT "This is a game of classic":PAUSE
  93. 1090 PRINT "Blackjack. The game uses 3":PAUSE
  94. 1100 PRINT "decks of cards for drawing.":PAUSE
  95. 1110 PRINT "After making your bet in":PAUSE
  96. 1120 PRINT "multiples of $10, the dealer":PAUSE
  97. 1130 PRINT "is dealt 2 cards, of which":PAUSE
  98. 1140 PRINT "only the top card is visible.":PAUSE
  99. 1150 PRINT "If the dealer draws Blackjack":PAUSE
  100. 1160 PRINT "(Ace and either a J, Q or K),":PAUSE
  101. 1170 PRINT "then you lose your bet.":PAUSE
  102. 1180 PRINT "Otherwise, you will be dealt":PAUSE
  103. 1190 PRINT "one card, following":PAUSE
  104. 1200 PRINT "which you will need to decide":PAUSE
  105. 1210 PRINT "whether you want to hit (H),":PAUSE
  106. 1220 PRINT "double (D), or stay (S). If":PAUSE
  107. 1230 PRINT "you hit, then you will be":PAUSE
  108. 1240 PRINT "dealt another card.":PAUSE
  109. 1250 PRINT "You can choose to double, at":PAUSE
  110. 1270 PRINT "which time your bet will be":PAUSE
  111. 1280 PRINT "doubled. Then, you will be":PAUSE
  112. 1290 PRINT "dealt only ONE more card and":PAUSE
  113. 1300 PRINT "no further hits will be":PAUSE
  114. 1310 PRINT "allowed. Once you stay, then":PAUSE
  115. 1320 PRINT "the dealer will start drawing":PAUSE
  116. 1330 PRINT "cards until the total is 17":PAUSE
  117. 1340 PRINT "or the dealer busts. Busting":PAUSE
  118. 1350 PRINT "for the player or dealer":PAUSE
  119. 1360 PRINT "occurs when the total is over":PAUSE
  120. 1370 PRINT "21. If the dealer busts or":PAUSE
  121. 1380 PRINT "has a total less than the":PAUSE
  122. 1390 PRINT "player, then the player wins":PAUSE
  123. 1400 PRINT "2 times the current bet.":PAUSE
  124. 1401 PRINT "If the player has blackjack,":PAUSE
  125. 1402 PRINT "then he/she wins 2 1/2 times":PAUSE
  126. 1403 PRINT "the amount of the bet.":PAUSE
  127. 1410 PRINT "If the dealer and player are":PAUSE
  128. 1420 PRINT "equal, then the bet is returned":PAUSE
  129. 1430 PRINT "to the player. Otherwise, the":PAUSE
  130. 1440 PRINT "bet is lost. In any case, the":PAUSE
  131. 1450 PRINT "player may play again. If no":PAUSE
  132. 1460 PRINT "money is left, then the player":PAUSE
  133. 1470 PRINT "makes a trip to the ATM for":PAUSE
  134. 1480 PRINT "more money...":PAUSE
  135. 1490 PRINT "Card values are as follows:":PAUSE
  136. 1500 PRINT "A is 11 or 1, J, Q, & K are":PAUSE
  137. 1510 PRINT "10, and the rest are at face":PAUSE
  138. 1520 PRINT "value.":PAUSE
  139. 1490 PRINT "Have fun!":PAUSE:RETURN
  140.