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)
81 HCOLOR= 7: HPLOT 0,68 TO 279,68: HPLOT 0,124 TO 279,124: RETURN
999 REM PAGE 1
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."
1010 FOR I = 13 TO 1 STEP -1:X = 9 +(13 -I) *19:Y = 56:VA = I:SU = 4: GOSUB 23: NEXT
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."
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)."
1040 RETURN
1099 REM PAGE 2
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"
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.)"
1120 GOSUB 8960
1130 VTAB 17: PRINT " Score is traditionally counted up the outside and down the inside, like this:"
1140 PL = 1:S = 60: GOSUB 8500
1150 VTAB 19: PRINT " A game is 121 points (twice around plusone), but a variant is 61 points (once around plus one)."
1190 RETURN
1199 REM PAGE 3
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."
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."
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:"
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"
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.)"
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"
1930 VTAB 13: HTAB 7: PRINT "as the 'STARTER' is": VTAB 14: HTAB 7: PRINT "'ONE FOR HIS NOB'": GOSUB 70
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."
1990 RETURN
1999 REM PAGE 11
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."
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."
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."
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."
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."
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.)"
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."
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."
2290 RETURN
2299 REM PAGE 14
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"
2310 PRINT "cards as he can. If he cannot play, he says 'GO'. The last player to say 'GO' pegs 1 point."
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."
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."
2390 RETURN
2399 REM PAGE 15
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."
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."
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."
2430 PRINT : PRINT "(This all sounds more difficult than it really is - when you've played a few hands it will be second nature.)"
2490 RETURN
2499 REM PAGE 17
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."
2510 PRINT : PRINT " Now the dealer exposes his cards and counts his score, remembering to includethe STARTER as part of his hand."
2520 PRINT : PRINT " Finally, the dealer shows the CRIB and counts the score of it with the STARTER."
2530 PRINT " Traditionally, all FIFTEENS are countedfirst, then RUNS and PAIRS. Players should watch their opponent score, sinceall points must be counted."
2540 PRINT " (In the variant called MUGGINS, if a player fails to see some points, the opponent may score them for himself!)"
2590 RETURN
2599 REM PAGE 19
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:"
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"
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!"
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."
2690 RETURN
2699 REM PAGE 20
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"
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."
2720 PRINT : PRINT " This game is played strictly with the keyboard. Here is a summary of all the command keys and what they do:"
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."
2790 RETURN
2799 REM PAGE 21
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"
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";
2820 PRINT " key. This key will be used as your command if it is going to be your turn."
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."
2840 PRINT " the cards that make up a scoring comb- ination will be highlighted and its name and value will be displayed."
2890 RETURN
2899 REM PAGE 22
2900 GOSUB 50: PRINT "? - Help. A summary of the commands.": PRINT : PRINT "<- - Move highlight box left.": PRINT : PRINT "/> - Move highlight box right."
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'"
2920 PRINT " to put them in the CRIB and go to the play of the hand."
2930 PRINT : PRINT "P - Play. During the playing of the hand, play the highlighted card."
2990 RETURN
2999 REM PAGE 23
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."
3090 RETURN
3099 REM PAGE 24
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";
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.)"
3120 PRINT : PRINT " The high score list is sorted first on WON-LOST percentage, then on WINNINGS."
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."
3190 RETURN
3199 REM PAGE 25
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"
3210 PRINT "other way shape or form cheat or give you less chance of winning."
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."
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."
3290 RETURN
3299 REM PAGE 26
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."
3310 PRINT : PRINT " If you lose consistently to my alter ego, feel free to send me his winnings!": PRINT : PRINT : PRINT : PRINT : PRINT " ENJOY!"
3390 RETURN
6999 REM NEW PAGE 16
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
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.)"
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)
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."
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."
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?"
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'."
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."
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. "
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
8969 REM SUBROUTINE TO DRAW THE SCORING HOLES
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
8979 REM SUBROUTINE TO DRAW THE GAME HOLES
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
8989 REM SUBROUTINE TO GET A KEYPRESS. RETURNS ASCII VALUE IN P. UPPER CASE IS CONVERTED TO LOWER CASE.
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
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
8992 IF P < >89 THEN 8991
8993 PE = 0: PRINT : PRINT "<CTRL-0x04>RUNCRIBBAGE.HIGH"