home *** CD-ROM | disk | FTP | other *** search
/ Softdisk G-S 98 / SGDS 98.2mg / SDGS.98 / SDA98 / A / CRIBBAGE.TUTOR (.txt) < prev    next >
Encoding:
Applesoft BASIC Source Code  |  1989-10-13  |  18.0 KB  |  245 lines  |  [FC] Applesoft BASIC Program (0x0801)

  1. 0  REM **********************
  2. 1  REM * CRIBBAGE  TUTORIAL *
  3. 2  REM *                    *
  4. 3  REM * BY  PETER ROKITSKI *
  5. 9  REM **********************
  6. 10  GOTO 10000
  7. 19  REM SUBROUTINE TO DRAW A CARD. SET X,Y,VA AND SU - THEN CALL PROPER ROUTINE. 20-BLANK. 21-HOLD. 22-SHUFFLE. 23-FRONT. 24-BACK.
  8. 20 ML = 0: HCOLOR= 4: GOTO 25
  9. 21 ML = 3: GOTO 25
  10. 22 ML = 6: GOTO 25
  11. 23 ML = 9: GOTO 25
  12. 24 ML = 12
  13. 25  POKE 1,X/256: POKE 2,Y: POKE 0,X -256 * PEEK(1): POKE 3,VA: POKE 4,SU: IF ML = 3  THEN  POKE 4,0
  14. 26  CALL ML +4400: RETURN 
  15. 39  REM CENTER P$ ON LINE V
  16. 40  VTAB V: HTAB 1:WD = 40 - LEN(P$): PRINT  SPC( WD/2)P$ SPC( (WD +1)/2);: RETURN 
  17. 49  REM CLEAR THE SCREEN BY PRINTING A CRTL-L
  18. 50  PRINT "<CTRL-0x0c>"
  19. 59  REM PUT TITLE AND PAGE NUMBER AT TOP, ARROWS AND ESC MESSAGE AT BOTTOM 
  20. 60  VTAB 24: HTAB 1: PRINT  SPC( 38);: HTAB 1: PRINT "<-";: HTAB 16: PRINT "ESC  QUITS";: HTAB 39: PRINT "/>": VTAB 1: HTAB 1: PRINT TI$;: HTAB 34: PRINT "PAGE " SPC( PG <10)PG: VTAB 3: HTAB 1: RETURN 
  21. 69  REM PUT THE SCORING DATA AFTER A SAMPLE HAND
  22. 70  VTAB V: HTAB 30: PRINT D$(H,0): VTAB V +1: HTAB 30: PRINT D$(H,1): VTAB V +2: HTAB 30: PRINT "VALUE IN:"
  23. 80  VTAB V +3: HTAB 32: PRINT "PLAY   "D$(H,2): VTAB V +4: HTAB 32: PRINT "HAND   "D$(H,3): VTAB V +5: HTAB 32: PRINT "CRIB   "D$(H,4)
  24. 81  HCOLOR= 7: HPLOT 0,68 TO 279,68: HPLOT 0,124 TO 279,124: RETURN 
  25. 999  REM PAGE 1
  26. 1000  GOSUB 50: PRINT " The game of CRIBBAGE was invented in   England in the early 1600's. It combinesskill and the luck of the draw in equal proportions."
  27. 1010  FOR I = 13 TO 1  STEP  -1:X = 9 +(13 -I) *19:Y = 56:VA = I:SU = 4: GOSUB 23: NEXT 
  28. 1020  VTAB 14: PRINT " It uses the standard 52 card deck, withKING being high, and ACE low. The value of a card is its pip count, except face cards which count ten."
  29. 1030  PRINT : PRINT " To determine the first dealer, players draw a card; the low card deals first.  Suit breaks ties - CLUBS(low), DIAMONDS,HEARTS, SPADES(high)."
  30. 1040  RETURN 
  31. 1099  REM PAGE 2
  32. 1100  GOSUB 50: PRINT " Central to the play of CRIBBAGE is the cribbage board. It is usually made of   wood and has 4 tracks of 30 holes to"
  33. 1110  PRINT "keep track of the players scores.": PRINT " In the middle are the game holes, used to determine when a player has won a    match. (Yours are on the right.)"
  34. 1120  GOSUB 8960
  35. 1130  VTAB 17: PRINT " Score is traditionally counted up the  outside and down the inside, like this:"
  36. 1140 PL = 1:S = 60: GOSUB 8500
  37. 1150  VTAB 19: PRINT " A game is 121 points (twice around plusone), but a variant is 61 points (once  around plus one)."
  38. 1190  RETURN 
  39. 1199  REM PAGE 3
  40. 1200  GOSUB 50: PRINT " The basic ways to score are by making  PAIRS, RUNS and FIFTEENS.": PRINT : PRINT " A PAIR is two of the same kind of card and is worth 2 points."
  41. 1210  PRINT " A RUN is any set of at least 3 cards,  regardless of suit, in sequence. It is  worth 1 point for each card in the run.": PRINT " FIFTEENS count 2 points and are made   when the total of a set of cards is 15."
  42. 1220 Y = 13 *8:X = 1:SU = 4:VA = 13: GOSUB 23:X = X +14:SU = 3: GOSUB 23: VTAB 20: HTAB 1: PRINT "PAIR (2)"
  43. 1230 X = 53:SU = 1:VA = 1: GOSUB 23:X = X +14:SU = 2:VA = 2: GOSUB 23:X = X +14:SU = 1:VA = 3: GOSUB 23: VTAB 20: HTAB 10: PRINT "RUN (3)"
  44. 1240 X = 119:SU = 3:VA = 9: GOSUB 23:X = X +14:VA = 10: GOSUB 23:VA = 11:X = X +14: GOSUB 23:VA = 12:X = X +14: GOSUB 23: VTAB 20: HTAB 20: PRINT "RUN (4)"
  45. 1250 X = 199:SU = 1:VA = 1: GOSUB 23:X = X +14:SU = 2:VA = 3: GOSUB 23:SU = 3:VA = 5:X = X +14: GOSUB 23:SU = 4:VA = 6:X = X +14: GOSUB 23: VTAB 20: HTAB 30: PRINT "FIFTEEN (2)"
  46. 1290  RETURN 
  47. 1299  REM PAGE 4
  48. 1300  GOSUB 50: PRINT " Each and every combination of cards    that is a PAIR, a RUN, or totals FIFTEENis counted. Thus, a PAIR ROYAL is worth 6 points since it contains 3 pairs:"
  49. 1310  FOR I = 0 TO 2:Y = 7 *8:X = I *40 +1:SU = I +1:VA = 9: GOSUB 23: NEXT : VTAB 9: HTAB 30: PRINT "PAIR ROYAL": VTAB 11: HTAB 30: PRINT "VALUE:  6"
  50. 1320 X = 1:Y = 13 *8 +4:SU = 1: GOSUB 23:X = X +14:SU = 2: GOSUB 23:X = X +14:SU = 3: POKE 4397,4: GOSUB 23: POKE 4397,7: VTAB 21: PRINT " PAIR (2)"
  51. 1330 X = 71:SU = 1: GOSUB 23: POKE 4397,4:SU = 2:X = X +14: GOSUB 23: POKE 4397,7:X = X +14:SU = 3: GOSUB 23: VTAB 21: HTAB 12: PRINT "PAIR (2)"
  52. 1340 X = 141:SU = 1: POKE 4397,4: GOSUB 23: POKE 4397,7:SU = 2:X = X +14: GOSUB 23:SU = 3:X = X +14: GOSUB 23: VTAB 21: HTAB 22: PRINT "PAIR (2)"
  53. 1390  RETURN 
  54. 1399  REM PAGE 5
  55. 1400  GOSUB 50: PRINT " What follows is a summary of all the   ways to score. Make sure you understand why each example hand is worth the givenamount. (Scoring during play will be    explained in a moment.)"
  56. 1410 H = 0:V = 10:Y = 8 *(V -1):X = 1:SU = 3:VA = 5: GOSUB 23:X = 41:SU = 1:VA = 12: GOSUB 23: GOSUB 70
  57. 1420 H = 1:V = 17:Y = 8 *(V -1):X = 1:SU = 4:VA = 6: GOSUB 23:X = 41:SU = 2:VA = 13: GOSUB 23:X = 81:VA = 10: GOSUB 23:SU = 3:VA = 5:X = 121: GOSUB 23: GOSUB 70
  58. 1490  RETURN 
  59. 1499  REM PAGE 6
  60. 1500  GOSUB 50:H = 2:V = 3: VTAB 4: HTAB 1: PRINT "When a player cannot play": PRINT "without exceeding 31, his": PRINT "opponent scores 1 for 'GO'"
  61. 1510  GOSUB 70:H = 3:V = 10: VTAB 12: HTAB 1: PRINT "The player who plays the": PRINT "LAST CARD pegs 1.": GOSUB 70
  62. 1520 H = 4:V = 17:VA = 11:SU = 4:X = 1:Y = 128: GOSUB 23: VTAB 18: HTAB 7: PRINT "When a jack is turned": VTAB 19: HTAB 7: PRINT "up as STARTER, dealer": VTAB 20: HTAB 7: PRINT "pegs 2 immediately": GOSUB 70
  63. 1590  RETURN 
  64. 1599  REM PAGE 7
  65. 1600  GOSUB 50:H = 5:V = 3:X = 1:Y = 16:VA = 6:SU = 4: GOSUB 23:SU = 3:X = 41: GOSUB 23: GOSUB 70
  66. 1610 H = 6:V = 10:X = 1:Y = 72:VA = 12:SU = 1: GOSUB 23:X = 41:SU = 4: GOSUB 23:X = 81:SU = 3: GOSUB 23: GOSUB 70
  67. 1620 H = 7:V = 17:X = 1:Y = 128:VA = 1:SU = 3: FOR I = 0 TO 3:X = I *40 +1:SU = I +1: GOSUB 23: NEXT : GOSUB 70
  68. 1690  RETURN 
  69. 1699  REM PAGE 8
  70. 1700  GOSUB 50:H = 8:V = 3:X = 1:Y = 16:SU = 1:VA = 8: GOSUB 23:VA = 9:X = 41: GOSUB 23:X = 81:VA = 10:SU = 2: GOSUB 23: VTAB 4: HTAB 18: PRINT "1 point"
  71. 1710  VTAB 5: HTAB 18: PRINT "for each": VTAB 6: HTAB 18: PRINT "card in": VTAB 7: HTAB 18: PRINT "the RUN": GOSUB 70
  72. 1720 H = 9:V = 10:Y = 72:VA = 2:SU = 4:X = 1: GOSUB 23:VA = 3:X = 41:SU = 2: GOSUB 23:SU = 1:X = 81: GOSUB 23:X = 121:SU = 2:VA = 4: GOSUB 23: GOSUB 70
  73. 1730 H = 10:V = 17:Y = 128:VA = 10:SU = 1:X = 1: GOSUB 23:SU = 3:X = 41:VA = 11: GOSUB 23:VA = 12:X = 81: GOSUB 23:SU = 2:X = 121: GOSUB 23:VA = 13:SU = 4:X = 161: GOSUB 23: GOSUB 70
  74. 1790  RETURN 
  75. 1799  REM PAGE 9
  76. 1800  GOSUB 50:V = 3:Y = 16:H = 11:X = 1:VA = 8:SU = 4: GOSUB 23:VA = 9:X = 41: GOSUB 23: FOR I = 1 TO 3:VA = 10:X = 40 *I +41:SU = I: GOSUB 23: NEXT : GOSUB 70
  77. 1810 H = 12:X = 1:VA = 1:SU = 4:V = 10:Y = 72: GOSUB 23:SU = 3:X = 41: GOSUB 23:VA = 2:X = 81: GOSUB 23:SU = 4:X = 121: GOSUB 23:VA = 3:SU = 1:X = 161: GOSUB 23: GOSUB 70
  78. 1820 H = 13:X = 1:Y = 128:V = 17:SU = 1:VA = 1: GOSUB 23:VA = 2:X = 41: GOSUB 23:VA = 8:X = 81: GOSUB 23:VA = 11:X = 121: GOSUB 23:VA = 12:X = 161: GOSUB 23: GOSUB 70
  79. 1890  RETURN 
  80. 1899  REM PAGE 10
  81. 1900  GOSUB 50:H = 14:SU = 2:VA = 3:X = 1:Y = 16:V = 3: GOSUB 23:VA = 4:X = 41: GOSUB 23:VA = 10:X = 81: GOSUB 23:VA = 13:X = 121: GOSUB 23: VTAB 5: HTAB 24: PRINT "MUST"
  82. 1910  VTAB 6: HTAB 24: PRINT "be in": VTAB 7: HTAB 24: PRINT "HAND!": GOSUB 70
  83. 1920 H = 15:X = 1:V = 10:Y = 72:VA = 11:SU = 3: GOSUB 23: VTAB 12: HTAB 7: PRINT "JACK of the same suit"
  84. 1930  VTAB 13: HTAB 7: PRINT "as the 'STARTER' is": VTAB 14: HTAB 7: PRINT "'ONE FOR HIS NOB'": GOSUB 70
  85. 1940  VTAB 17: PRINT " The largest hand is all four 5's with  the JACK OF NOB for 29 points. 12 for a DOUBLE PAIR ROYAL, 8 for 15's with the  jack, 8 for 15's with the 5's, and ONE  FOR HIS NOB."
  86. 1990  RETURN 
  87. 1999  REM PAGE 11
  88. 2000  GOSUB 50: PRINT " The deal is 6 cards, one at a time,    starting with non-dealer. The deal      alternates during play, except the loserof a game always gets next deal."
  89. 2010  PRINT " The major advantage of being the dealeris that you get the crib. The minor     advantage is that you are assured of    getting at least 1 point during the playof the hand."
  90. 2020  PRINT : PRINT " Each player examines his hand and pickstwo cards to lay-away to the crib. Thus,each hand and the crib will have four   cards when the lay-away is complete."
  91. 2030  PRINT : PRINT " Next, the top card is turned over as   the STARTER. If it is a jack, the dealerpegs 'TWO FOR HIS HEELS'. The STARTER isnot used during play. It is treated as  a part of all hands during hand scoring."
  92. 2090  RETURN 
  93. 2099  REM PAGE 12
  94. 2100  GOSUB 50: PRINT " Here's how it looks during the game:":X = 245:Y = 80: GOSUB 24:X = 3:Y = 32: GOSUB 24:Y = 128:VA = 1:SU = 4: GOSUB 23:X = 43:Y = 32: GOSUB 24:VA = 4:SU = 4:Y = 128: GOSUB 23
  95. 2110 X = 83:Y = 32: GOSUB 24:Y = 128:VA = 6:SU = 2: GOSUB 23:X = 123:Y = 32: GOSUB 24:Y = 128:VA = 7:SU = 1: GOSUB 23
  96. 2120 X = 163:Y = 32: GOSUB 24:Y = 128:SU = 3: GOSUB 23:X = 203:Y = 32: GOSUB 24:Y = 128:VA = 8:SU = 4: GOSUB 23
  97. 2125 X = 245:Y = 128: GOSUB 21: POKE 32,37: POKE 33,1: VTAB 18: PRINT "CRIB": POKE 32,0: POKE 33,40
  98. 2130  VTAB 12: PRINT "You have an easy hand to work with.": PRINT "You obviously lay-away the ACE and": PRINT "the FOUR, leaving a DOUBLE RUN OF": PRINT "THREE with two FIFTEENS as well."
  99. 2135  VTAB 24: HTAB 1: PRINT "  ";: HTAB 38: PRINT "  ";: HTAB 15: PRINT "PRESS A KEY"
  100. 2140  GOSUB 8990:X = 3:Y = 32: GOSUB 20:X = 245:Y = 128: GOSUB 24:X = 43:Y = 32: GOSUB 20:X = 245:Y = 128: GOSUB 24:X = 3:Y = 128: GOSUB 20:X = 245: GOSUB 24:X = 43: GOSUB 20:X = 245: GOSUB 24
  101. 2150 VA = 10:SU = 4:X = 245:Y = 80: GOSUB 23: GOSUB 60
  102. 2160  VTAB 12: HTAB 1: PRINT  SPC( 35): VTAB 13: HTAB 1:: PRINT "Now you're ready to play the hand.": VTAB 14: HTAB 1: PRINT  SPC( 35): VTAB 15: HTAB 1: PRINT  SPC( 35)
  103. 2190  RETURN 
  104. 2199  REM PAGE 13
  105. 2200  GOSUB 50: PRINT " The non-dealer starts the play by      playing any one of his four cards face  up in front of him, saying aloud the    counting value of the card. (Remember   face cards count 10.)"
  106. 2210  PRINT : PRINT " The dealer then plays any one of his   cards and announces the sum of both the cards. Non-dealer plays another card    and says the sum of all cards played."
  107. 2220  PRINT : PRINT " Play alternates until the total of 31  is reached. The player who made 31 pegs 2, the face up cards are turned face    down in front of the respective players,and the other player then leads a card  with the sum reset to 0."
  108. 2290  RETURN 
  109. 2299  REM PAGE 14
  110. 2300  GOSUB 50: PRINT " If a player has no card that causes thesum to be 31 or less, he says 'GO' and  the other player must now play as many"
  111. 2310  PRINT "cards as he can. If he cannot play, he  says 'GO'. The last player to say 'GO'  pegs 1 point."
  112. 2315  PRINT : PRINT " After a second 'GO', the cards are     turned face down in front of the playersand the sum reset to 0. The player who  first said 'GO' now leads."
  113. 2320  PRINT : PRINT " The player who plays the last card of  the hand pegs 1 for 'LAST CARD', EXCEPT if it brings the total to 31 - in which case he pegs 2 for 31 and there is no   last card."
  114. 2390  RETURN 
  115. 2399  REM PAGE 15
  116. 2400  GOSUB 50: PRINT " While the hand is being played, points are scored for FIFTEEN, the combinationsof PAIRS, and straight RUNS. The cards  must be played in succession with no    intervening cards to score the PAIRS."
  117. 2410  PRINT : PRINT " RUNS may be filled in in any order,    counting all cards from the card last   played and going back in order of play."
  118. 2420  PRINT : PRINT "Thus, if order of play is 3, 2, 4, a RUNOF THREE will be scored for 3 points,   but 3, 2, 2, 4 will not score as a RUN, the PAIR of 2's having been scored and  interupting the RUN."
  119. 2430  PRINT : PRINT "(This all sounds more difficult than it really is - when you've played a few    hands it will be second nature.)"
  120. 2490  RETURN 
  121. 2499  REM PAGE 17
  122. 2500  GOSUB 50: PRINT " After all cards have been played, the  non-dealer exposes his cards and counts the score of his hand. He includes the  STARTER as part of his hand."
  123. 2510  PRINT : PRINT " Now the dealer exposes his cards and   counts his score, remembering to includethe STARTER as part of his hand."
  124. 2520  PRINT : PRINT " Finally, the dealer shows the CRIB and counts the score of it with the STARTER."
  125. 2530  PRINT " Traditionally, all FIFTEENS are countedfirst, then RUNS and PAIRS. Players     should watch their opponent score, sinceall points must be counted."
  126. 2540  PRINT " (In the variant called MUGGINS, if a   player fails to see some points, the    opponent may score them for himself!)"
  127. 2590  RETURN 
  128. 2599  REM PAGE 19
  129. 2600  GOSUB 50: PRINT " The first player to get 121 points     wins - the game ends and no further     scoring is done. The order of precedencefor winning a game is therefore:"
  130. 2610  PRINT "  1) By HIS HEELS,": PRINT "  2) During play,": PRINT "  3) Scoring of non-dealers hand": PRINT "  4) Scoring of dealers hand": PRINT "  5) Scoring of CRIB"
  131. 2620  PRINT : PRINT " If the loser of the game does not have at least 61 points, the winner has made a 'LURCH'. A LURCH counts twice, so the winner gets 2 wins and double points!"
  132. 2630  PRINT : PRINT " For this program, a MATCH is ten games.You get 1 point per score differential  when you win, 25 points for a game, and 500 points for winning a match."
  133. 2690  RETURN 
  134. 2699  REM PAGE 20
  135. 2700  GOSUB 50: PRINT " When the game is played, you will be   asked 'Have we played before? (Y or N)',then it will ask you for your name. The program keeps a file for every player's"
  136. 2710  PRINT "score, but a name can be used only once.": PRINT " If you've never played before, you'll  cut cards for first deal. If you have   played before, your overall stats will  be shown, then the current game score."
  137. 2720  PRINT : PRINT " This game is played strictly with the  keyboard. Here is a summary of all the  command keys and what they do:"
  138. 2730  PRINT : PRINT "ESC - Quit. You may quit at any time,    even the middle of a game. If you quit  during a hand, you'll be asked to       finish it first so that the current     match status can be saved."
  139. 2790  RETURN 
  140. 2799  REM PAGE 21
  141. 2800  GOSUB 50: PRINT "S - Sound toggle. Turns sound ON & OFF.": PRINT : PRINT "D - Delay. When a message is displayed,  it remains on screen for an amount of   time determined by delay. A delay of 0"
  142. 2810  PRINT " is a couple of seconds on a 1 megahertz machine. The longer delays are for the  faster machines. Any time a delay is in effect, you can exit it by pressing any";
  143. 2820  PRINT " key. This key will be used as your      command if it is going to be your turn."
  144. 2830  PRINT "W - Watch hand scoring toggle. When you  boot-up, only the total score of a hand will be displayed. If you have never    played before, you should hit 'W' so    you'll see the hands being scored i.e."
  145. 2840  PRINT " the cards that make up a scoring comb-  ination will be highlighted and its     name and value will be displayed."
  146. 2890  RETURN 
  147. 2899  REM PAGE 22
  148. 2900  GOSUB 50: PRINT "? - Help. A summary of the commands.": PRINT : PRINT "<- - Move highlight box left.": PRINT : PRINT "/> - Move highlight box right."
  149. 2910  PRINT : PRINT "SPC - Hold. During lay-away, space bar   'HOLDS' a card by inverting it. To drop a card, 'HOLD' it again.": PRINT : PRINT "L - Lay-away. When you have the 2 cards  you want to lay-away 'HELD', press 'L'"
  150. 2920  PRINT " to put them in the CRIB and go to the   play of the hand."
  151. 2930  PRINT : PRINT "P - Play. During the playing of the      hand, play the highlighted card."
  152. 2990  RETURN 
  153. 2999  REM PAGE 23
  154. 3000  GOSUB 50: PRINT "G - Go. During play, when you cannot     play without exceeding 31, you must hit 'G' for GO.": PRINT : PRINT "RETURN - Go. An alternate 'GO' key,      chosen for its location by the other    action keys."
  155. 3090  RETURN 
  156. 3099  REM PAGE 24
  157. 3100  GOSUB 50: PRINT " Your hand is dealt sorted since most   people find it easier to count that way.This is a bad thing to do against a liveopponent since you are giving away an   awful lot of information about your hand";
  158. 3110  PRINT "by the position your cards come from.": PRINT " The computer does not try to analyze   your hand by the position of your cards.(By the way, the computer's hand is not sorted when it is dealt.)"
  159. 3120  PRINT : PRINT " The high score list is sorted first on WON-LOST percentage, then on WINNINGS."
  160. 3130  PRINT : PRINT " There is no 'OOPS' feature since you   would gain information about my hand    before you could 'OOPS'. A mistake needsto be enforced, like 'TOUCH-MOVE' in    chess, so you learn to be careful."
  161. 3190  RETURN 
  162. 3199  REM PAGE 25
  163. 3200  GOSUB 50: PRINT " I, Peter Rokitski, do hereby attest,   aver, avow, confirm, state and swear    that the computer does not: look at yourcards, look ahead at the starter, deal  off the bottom of the deck, or in any"
  164. 3210  PRINT "other way shape or form cheat or give   you less chance of winning."
  165. 3220  PRINT : PRINT " I wrote the thing and sometimes the wayit manages to keep just the right cards can make me wonder how it does it. But  I know it's only 'human' after all,     since I lurched it once."
  166. 3230  PRINT : PRINT " My record at this time is 59-61 (491)  and - 606 winnings. Even though I know  the logic it uses to play its cards."
  167. 3290  RETURN 
  168. 3299  REM PAGE 26
  169. 3300  GOSUB 50: PRINT " If you win consistently and have a     record over 500 after playing, say 100  games, I'd like you to write a letter   to Softdisk describing your playing     style."
  170. 3310  PRINT : PRINT " If you lose consistently to my alter   ego, feel free to send me his winnings!": PRINT : PRINT : PRINT : PRINT : PRINT " ENJOY!"
  171. 3390  RETURN 
  172. 6999  REM NEW PAGE 16
  173. 7000  GOSUB 50: PRINT " Back to our example:":X = 245:Y = 80:VA = 10:SU = 4: GOSUB 23: FOR I = 0 TO 3:Y = 32:X = 83 +40 *I: GOSUB 24: NEXT :Y = 128:VA = 6:SU = 2:X = 83: GOSUB 23:VA = 7:SU = 1:X = 123: GOSUB 23
  174. 7010 SU = 3:X = 163: GOSUB 23:VA = 8:SU = 4:X = 203: GOSUB 23:X = 83:Y = 32: GOSUB 20:X = 3:SU = 3:VA = 8: GOSUB 23: VTAB 24: HTAB 1: PRINT  SPC( 40): HTAB 15: PRINT "PRESS A KEY"
  175. 7015  VTAB 11: PRINT "TOTAL is 8.": PRINT : PRINT "You could play an 8 for a PAIR,": PRINT "(danger of PAIR ROYAL), a 7 for": PRINT "15, (danger of a RUN), or a 6 for": PRINT "nothing, (danger of a RUN.)"
  176. 7019  GOSUB 8990:X = 123:Y = 128: GOSUB 20:X = 3:VA = 7:SU = 1: GOSUB 23
  177. 7020  VTAB 11: PRINT "TOTAL is 15. Two points for 15.": PRINT : PRINT "You decide to take a 15, since you": PRINT "could PAIR ROYAL a 7 or continue a": PRINT "RUN or make a PAIR with a 6." SPC( 5)
  178. 7025  VTAB 16: HTAB 1: PRINT  SPC( 35): GOSUB 8990:X = 123:Y = 32: GOSUB 20:X = 17:VA = 6:SU = 1: GOSUB 23: VTAB 11: HTAB 1: PRINT "TOTAL is 21. 3 points for RUN OF 3."
  179. 7030  VTAB 13: HTAB 1: PRINT  SPC( 35): VTAB 14: HTAB 1: PRINT  SPC( 35): VTAB 15: HTAB 1: PRINT  SPC( 35)
  180. 7040  GOSUB 8990:X = 83:Y = 128: GOSUB 20:X = 17:VA = 6:SU = 2: GOSUB 23: VTAB 11: HTAB 1: PRINT "TOTAL is 27. Two points for a PAIR."
  181. 7045  VTAB 13: PRINT "You took the pair because you had": PRINT "your mind set on that strategy.": PRINT "But did you see that the 8 would": PRINT "have given you a RUN OF 3?"
  182. 7050  GOSUB 8990:X = 163:Y = 32: GOSUB 20:VA = 1:SU = 1:X = 31: GOSUB 23: VTAB 11: HTAB 1: PRINT "TOTAL is 28." SPC( 23): VTAB 13: HTAB 1: PRINT "You may not play a card without   ": PRINT "exceeding 31, so you must say 'GO'."
  183. 7055  PRINT "Your opponent now plays til he runs": PRINT "out of cards, or says 'GO'." SPC( 7): GOSUB 8990:X = 203:Y = 32: GOSUB 20:X = 45:VA = 1:SU = 3: GOSUB 23: VTAB 11: HTAB 1: PRINT "TOTAL is 29. Two points for a PAIR."
  184. 7060  VTAB 13: HTAB 1: PRINT "He also pegs a point since you said": PRINT "'GO'." SPC( 30): VTAB 15: HTAB 1: PRINT "All the cards are turned over and  ": PRINT "you lead with the total now zero.  "
  185. 7065  GOSUB 8990:Y = 32:X = 45: GOSUB 20:X = 17: GOSUB 20:X = 3: GOSUB 24:Y = 128:X = 17: GOSUB 20:X = 3: GOSUB 24:X = 163:Y = 128: GOSUB 20:X = 31:VA = 7:SU = 3: GOSUB 23
  186. 7070  VTAB 11: HTAB 1: PRINT "TOTAL is 7." SPC( 24): VTAB 13: HTAB 1: PRINT  SPC( 35): VTAB 14: HTAB 1: PRINT  SPC( 35): VTAB 15: HTAB 1: PRINT  SPC( 35): VTAB 16: HTAB 1: PRINT  SPC( 35)
  187. 7075  GOSUB 8990: VTAB 11:X = 203:Y = 128: GOSUB 20:X = 45:VA = 8:SU = 4: GOSUB 23: VTAB 11: HTAB 1: PRINT "TOTAL is 15. Two points for 15."
  188. 7080  VTAB 13: HTAB 1: PRINT "You also peg one for 'LAST CARD'.": PRINT "He scored 6 during play, you scored": PRINT "7."
  189. 7085  GOSUB 60
  190. 7090  RETURN 
  191. 7099  REM NEW PAGE 18
  192. 7100  GOSUB 50: PRINT " Let's finish our example:":X = 245:Y = 80:VA = 10:SU = 4: GOSUB 23:Y = 128: GOSUB 24:X = 3: GOSUB 24: VTAB 24: HTAB 1: PRINT  SPC( 40): HTAB 15: PRINT "PRESS A KEY"
  193. 7110 X = 83:Y = 32:VA = 1:SU = 1: GOSUB 23:SU = 3:X = 123: GOSUB 23:VA = 6:SU = 1:X = 163: GOSUB 23:X = 203:VA = 8:SU = 3: GOSUB 23
  194. 7120  VTAB 11: HTAB 1: PRINT "A,6,8 FIFTEEN two": PRINT "A,6,8 FIFTEEN four": PRINT "A,A   PAIR": PRINT : PRINT "TOTAL of 6."
  195. 7130  GOSUB 8990:Y = 32: FOR I = 0 TO 3:X = 83 +40 *I: GOSUB 20: NEXT :Y = 128:X = 3: GOSUB 20:VA = 6:SU = 2:X = 83: GOSUB 23:X = 123:VA = 7:SU = 1: GOSUB 23:X = 163:SU = 3: GOSUB 23:X = 203:VA = 8:SU = 4: GOSUB 23
  196. 7140  VTAB 11: HTAB 1: PRINT "7,8     FIFTEEN two": PRINT "7,8     FIFTEEN four": PRINT "6,7,7,8 DOUBLE RUN OF THREE": PRINT : PRINT "TOTAL is 12"
  197. 7150  GOSUB 8990: FOR I = 0 TO 3:X = 83 +40 *I: GOSUB 20: NEXT :X = 245: GOSUB 20:X = 83:VA = 1:SU = 4: GOSUB 23:X = 123:VA = 4: GOSUB 23:VA = 9:X = 163: GOSUB 23:VA = 11:X = 203: GOSUB 23
  198. 7160  VTAB 9: HTAB 1: PRINT "A,4,10 FIFTEEN two": PRINT "A,4,J  FIFTEEN four": PRINT "9,10,J RUN OF 3" SPC( 10)" ": PRINT "SPADES FLUSH" SPC( 10)" ": PRINT "J      HIS NOB" SPC( 20)" ": PRINT : PRINT "TOTAL is 13": GOSUB 60
  199. 7190  RETURN 
  200. 8499  REM SUBROUTINE TO MOVE THE PEGS AROUND THE BOARD.
  201. 8500 O = 0: FOR Q = 1 TO 60: GOSUB 8530: NEXT : RETURN 
  202. 8530  GOSUB 8540: FOR O = 0 TO 5: NEXT :O = Q
  203. 8540 O = O -60 *(O >60):Y = 85 +36 *PL: IF O >30  THEN O = 61 -O:Y = 93 +20 *PL
  204. 8550  IF   NOT O  THEN  RETURN 
  205. 8560  XDRAW 7 AT 8 *O -4,Y:O =  PEEK(SP):O = Q: RETURN 
  206. 8959  REM SUBROUTINE TO DRAW THE BOARD
  207. 8960  CALL 3331: HCOLOR= 7: HPLOT 0,80 TO 239,80 TO 239,126 TO 0,126 TO 0,80: HCOLOR= 4: FOR I = 240 TO 244: HPLOT I,80 TO I,126: NEXT : FOR I = 40 TO 239  STEP 40: HPLOT I,81 TO I,125: NEXT : HPLOT 2,98 TO 237,98: HPLOT 2,108 TO 237,108: GOSUB 8970: GOTO 8980
  208. 8969  REM SUBROUTINE TO DRAW THE SCORING HOLES
  209. 8970 SP = 49200 *SO: FOR I = 4 TO 240  STEP 8: DRAW 7 AT I,85:J =  PEEK(SP): DRAW 7 AT I,93:J =  PEEK(SP): DRAW 7 AT I,113:J =  PEEK(SP): DRAW 7 AT I,121:J =  PEEK(SP): NEXT : RETURN 
  210. 8979  REM SUBROUTINE TO DRAW THE GAME HOLES
  211. 8980  FOR I = 0 TO 9: DRAW 7 AT I *8 +4,103:J =  PEEK(SP): DRAW 7 AT 236 -8 *I,103:J =  PEEK(SP): NEXT : RETURN 
  212. 8989  REM SUBROUTINE TO GET A KEYPRESS. RETURNS ASCII VALUE IN P. UPPER CASE IS CONVERTED TO LOWER CASE.
  213. 8990  FOR P = 0 TO 127:P =  PEEK(49162): NEXT : POKE 49168,0:P = P -129:P = P -32 *(P >96): IF P < >27  OR PE  THEN PE = 0: RETURN 
  214. 8991 P$ = "DO YOU WANT TO QUIT? (Y OR N)":PE = 1:V = 24: GOSUB 40: GOSUB 8990: IF P = 78  THEN PE = 0: GOTO 60
  215. 8992  IF P < >89  THEN 8991
  216. 8993 PE = 0: PRINT : PRINT "<CTRL-0x04>RUNCRIBBAGE.HIGH"
  217. 10000  HGR : POKE  -16302,0: SCALE= 1:PG = 1:SO =  PEEK(4399): GOSUB 20000: GOTO 10050
  218. 10010  GOSUB 8990
  219. 10020  IF P = 8  OR P = 11  THEN PG = PG -1: GOTO 10050
  220. 10030  IF P = 21  OR P = 10  THEN PG = PG +1: GOTO 10050
  221. 10040  GOTO 10010
  222. 10050  IF PG <1  THEN PG = 26: PRINT  CHR$(7);: HCOLOR= 3: HPLOT 0,0: CALL 62454
  223. 10060  IF PG >26  THEN PG = 1: PRINT  CHR$(7);: HCOLOR= 3: HPLOT 0,0: CALL 62454
  224. 10070  IF PG <20  THEN TI$ = "CRIBBAGE: THE RULES"
  225. 10080  IF PG >19  AND PG <24  THEN TI$ = "CRIBBAGE: THE CONTROLS"
  226. 10090  IF PG >23  THEN TI$ = "CRIBBAGE: ODDS & ENDS"
  227. 10100  ON PG GOSUB 1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,7000,2500,7100,2600,2700,2800,2900,3000,3100,3200,3300
  228. 10110  GOTO 10010
  229. 20000  DATA FIFTEEN, ,2,2,2
  230. 20001  DATA THIRTY-ONE, ,2,-,-
  231. 20002  DATA GO, ,1,-,-
  232. 20003  DATA LAST CARD, ,1,-,-
  233. 20004  DATA TWO FOR HIS,"   HEELS",2,-,-
  234. 20005  DATA PAIR, ,2,2,2
  235. 20006  DATA PAIR ROYAL, ,6,6,6
  236. 20007  DATA DOUBLE PAIR,"   ROYAL",12,12,12
  237. 20008  DATA RUN OF X, ,X,X,X
  238. 20009  DATA DOUBLE RUN," OF THREE",-,8,8
  239. 20010  DATA DOUBLE RUN," OF  FOUR",-,10,10
  240. 20011  DATA TRIPLE RUN," OF THREE",-,15,15
  241. 20012  DATA QUADRUPLE," RUN OF 3",-,16,16
  242. 20013  DATA FLUSH, ,-,5,5
  243. 20014  DATA FOUR FLUSH, ,-,4,-
  244. 20015  DATA ONE FOR," HIS NOB",-,1,1
  245. 30000  DIM D$(15,5): FOR I = 0 TO 15: FOR J = 0 TO 4: READ D$(I,J): NEXT : NEXT : RETURN