Cribbage : FCRIBBAGE  GAMMA SOFTWARE 1984 &4:4:1:4: ""16384@ (2,0; 2"" scr J D p ? 8@|?8@?fl??pT?@?|l??`flp|Tf<<<8 ? ??| 9 ?} 8?x?# pD145))+N$(C(H(X,Y),2))+(C(H(X,Y),1))  0 @4:4:1:2,0;:"""A",64@ C(524,3) 2,0;:""C() X(10 ,5) 2,0;:""X() H236099\,9 :23693\,0:23624H\,6:7 #.2~L,30 c ---------------------- d CRIB n ---------------------- N$="A23456789JQK" %C$="" G(2) C=(.5+) +NEW GAME--------------- ,S(2):9100# 6QCA$=" I SCORE 3 'FOR LAST'  YOU GET FIRST CRIB " @PCA$=" YOU SCORE 3 'FOR LAST'  FIRST CRIB IS MINE " J.05|L,10 :#0;1,0;" INSTRUCTIONS ? [ Y / N ] ":0:#0;1,0,,:="Y"Ŧ="y"9700% NEW DEAL--------------- F=111 $65E3+F,(*524+1) G=1F-1 ,(65E3+F)=(65E3+G)420 G:F S(1+C)500 x.05|L,10 :#0;1,0;" [ PRESS ANY KEY FOR NEW DEAL ] ":0:#0;1,0,, W="r"Ŧ="R"R=1:9 ,9 ;1;"R":.05|L,22:5200P H(4,6):C=C  9500% &F=12:G=15 2H(F,G)=(65E3+G+(F-1)*5):G:F TU=(65011) &&G=15:F=01 +*6+14*F,6+G*3;C$ - 5 0*.003xD,40(:.005y# =,10 5F:G :+5:13 ,21-C*12 ;C$ ?*.003xD,40(:.005y# =,10 X)#0;1,0;A$(34") ]f=12 bA=4:9645% lF G=15 \17,6+G*3;4;G;20,6+G*3;7;C$(2,G) *.003xD,40(:.005y# =,10 G "S(1)S(2)1E3 *)#0;1,0;A$(35#) 4#Z=3:A=2-C:8E3@ MACHINE DISCARDS------- A=1:G=0 >T=0:F=15:T=T+C(H(1,F),3):F F=110 :Z=0 _C(H(1,X(F,1)),2)=C(H(1,X(F,3)),2)Z=24:10808 ^C(H(1,X(F,1)),2)=C(H(1,X(F,2)),2)Z=9 :1065) ^C(H(1,X(F,2)),2)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(A,4)) ,H(3,2)=H(1,X(A,5)) (!H(1,X(A,4))=0 2!H(1,X(A,5))=0 x.6,9 ;" ";6,21;" " IF=10 12 2:.005y# =,F:F,25-20*C;C$:F  30 USER DISCARDS---------- G.007ye`A,21:.007ye`A,33!:" DISCARDS ?? ";A$ A$21510 %A$(1)=A$(2)1510 4F=12:A$(F)<"1"A$(F)>"5"1510 F .H(3,3)=H(2,(A$(1))) ".H(3,4)=H(2,(A$(2))) ,#H(2,(A$(1)))=0 6#H(2,(A$(2)))=0 @9Z=12:F=12:G=14 J8H(F,G)H(F,G)=H(F,G+1):H(F,G+1)=0 T G:F:Z @20,0,,17,9 ;4;" " rF=13:17,9 +3*F;4;F;20,9 +3*F;7;C$(2,F):F IF=14162:.005y# =,F:F,25-20*C;C$:F H(3,5)=TU  40(  *.003xD,40(:.005y# =,10 =13 ,21-C*12 ;5;C$(3,5) :C(H(3,5),2)=11 #0;1,6;"'TWO FOR HIS HEELS'":Z=2:A=C+1:8E3@:502+C*150 PLAY------------------- #CP=1:T=0:CG=0  A=C+1 4------PLAY-LOOP------ > A=3-A HCG=A2110> OPTIONS?------- O=0:F=13 H(A,F)>100d2220 *C(H(A,F),3)+T>312220 O=O+1:F O2300 -O=1A=1PY=1:2290 2500 +500*A 4000:21004 CG=3-A30:13 ,15;A;T:A*14-8,9 ;"'ONE FOR LAST'":Z=1:8E3@:5E3 uH(A,1)<100d.1}L,0:7+4*A,14;4;"""GO""";#0;1,0,, CG=A:21004 MACHINE PLAY----------- SCORE? OO=1C(H(1,1),2)=C(H(1,O),2)PY=1: QQ=0 F=O1-1 H(4,CP)=H(1,F) 4500 Z>QQQQ=Z:PY=F F  QQZ=QQ: fO=2PY=2-(T+C(H(1,1),2)5T+C(H(1,1),2)*215ƽ(C(H(4,CP-1),2)-C(H(1,1),2))>1(T+C(H(1,2),3)=21T+C(H(1,2),3)*2=15Ž(C(H(4,CP-1),2)-C(H(1,2),2))=1)): NCP=1C(H(1,3),2)-C(H(1,1),2)=2PY=2-((C(H(1,2),2)=5C(H(1,1),2)5)C(H(1,1),2)=8)+(C(H(1,3),2)=7): F=31-1 O=T+C(H(1,F),3) GO=5O>15Ž(T-C(H(1,F),3)<3)3260 O<53450z G=13 F=G3250 ,O+C(H(1,G),3)=15PY=F: G F CP=13450z ... HA$="":F=13:A$=A$+(F(T+C(H(1,F),2)5T+C(H(1,F),2)*215)ƽ(C(H(4,1),2)-C(H(1,F),2))>1):F NA$="000"PY=2: PA$<12 PY=A$: RCPY=2-(T+C(H(1,2),2)>4T+C(H(1,1),2)<5T+C(H(1,3),2)<15)+((C(H(1,1),2)=C(H(1,2),2)T+C(H(1,1),2)=5)(T+C(H(1,2),2)<15T+C(H(1,3),2)>15)) f&A$(PY)="0"PY=PY+1PY=3 p y 1ST LEAD zPY=2-(C(H(1,2),2)>4C(H(1,1),2)<5)+(C(H(1,1),2)=C(H(1,2),2)C(H(1,1),2)=5): USER PLAY-------------- H.007ye`A,21:.007ye`A,30:" YOUR PLAY ? ";A$ -A$"1"A$OƱA$=1PY=A$(1): IO=1C(H(2,1),2)=C(H(2,O),2)PY=O:  3510 PLAY CARDS------------- H(4,CP)=H(A,PY)  4500 T=T+C(H(A,PY),3) *.003xD,40(:.005y# =,10 4Q=(.5+CP/2+(CG=3-ACP=4)) nA=16,21-3*Q;" ";9 ,21-3*Q;7;C$(1,PY):4200h A=220,12 ;" ":17,21-3*Q;7;C$(2,PY):4200h:F=13-Q:20,9 +3*F;7;C$(2,F):F AAZ;13 ,15;"0 ";13 ,15+(T<10 );T; SZ#0;1,16-D$/2;D$(̱D$-1):8E3@:30*Z T=315E3 "CP=CP+1 6 hSHIFTDOWN-------------- rH(A,PY)=H(A,PY)+100d |PY=3 _PY=2H(A,4)=H(A,2):H(A,2)=H(A,3):H(A,3)=H(A,4): nH(A,4)=H(A,1):H(A,1)=H(A,2):H(A,2)=H(A,3):H(A,3)=H(A,4): PLAY-SCORE DETECTOR---- D$="" $Q=0:Z=0:CP=1  PRS?----  G=CP2-1 EC(H(4,G),2)C(H(4,G-1),2)46604  Q=Q+1:G 45Z=2*Q+2*(Q>1)+4*(Q>2) 9Z=2D$=" PAIR +" >"Z=6D$=" PAIRS ROYAL +" C)Z=12 D$=" DOUBLE PAIRS ROYAL +" HFC(H(4,CP),3)+T=15Z=Z+2:D$=D$+" FIFTEEN +" JIC(H(4,CP),3)+T=31Z=Z+2:D$=D$+" THIRTY-ONE +" MQ R RUNS?---- \A$="-----*-----" ^B$=A$ aG=CP-11-1 f4Q=C(H(4,CP),2)-C(H(4,G),2) kQCPQ=CP-G:4730z n'A$(Q+6)"-"Q=CP-G:4730z pA$(Q+6)="+":G zCP-G<3 =Q=1:H=-112:G=1CP-1 #A$(6+(H*G))="-"4830 B$(6+(H*G))="+" Q=Q+1:G H  Q<3 G=1Q-1 QB$(6+C(H(4,CP),2)-C(H(4,CP-G),2))"+"4870 G:4980t  G<3 QI=CP-QQ-G:B$(6+C(H(4,CP),2)-C(H(4,I),2))="-":I $=Q=1:H=-112:G=1CP-1 .#B$(6+(H*G))"+"4930B 8Q=Q+1:G BH t*Q>2Z=Z+Q:D$=D$+" RUN ("+Q+") " ~ CP:F=1CP:(F),H(4,F):F 4500:A$,B$,Q,Z:4992: SHOW-------------------  R=0 2H(4,1)=TU 7.05|L,10 CP-26400 M(4):A$=(G+1) G A$<36800  Q>56600 (Z=Z+A$:7E3X 2Q6800 d]I=1M(Q):A$=A$(Q-1)+((A$(Q)+1))+A$(Q+1):Z=Z+A$:7E3X:I n 6800 2*2;11223,11233,12233 uM(1)M(2)G=12:I=34:A$=G+I+"5":Z=Z+3:7E3X:I:G:6800 uM(1)M(3)G=12:I=45:A$=G+"3"+I:Z=Z+3:7E3X:I:G:6800 uM(2)M(3)G=23:I=45:A$="1"+G+I:Z=Z+3:7E3X:I:G:6800 FLUSHES................ UA$="12345":A$=A$(CP):Q=C(H(F,1+(H(4,1)=H(F,1))),1) wG=1CP:H(4,1)=H(F,G)C(H(4,1),1)QA$=A$(G-1)+A$(G+1):6840 !C(H(F,G),1)Q6900 &G:F=3ƱA$56900  Z=Z+A$:B$="FLUSH":7E3X HIS NOB................ G=1CP C(H(F,G),2)=11 H(F,G)H(4,1)C(H(F,G),1)=C(H(4,1),1)A$=G:B$="'ONE FOR HIS NOBS'":Z=Z+1:7E3X: &G: XPRINT SUB-TOT---------- \#23672x\<75K7004\ ^23672x\,0 `913 ,0;1;8;8;0,, bH=1̱A$ g.02{# =,13 lV1;1;8;8;13 ,CP+1+(8-CP)*A$(H);" ":H v20,0,, #20,16-B$/2;B$ ,8;16,15+(Z<10 );Z  @SCORE------------------ T H=1Z ^S(A)=S(A)+1 hS(A)=61=85004! r1;6;A;2+(2*A-3)*(1+(S(A)<31)),S(A)-(S(A)>30)*(2*(S(A)-30)-1);" " |$.01z# =,10 +S(A)/2:H  !4WINNER----------------- !>bZ=14:G=07:2,1;G;7-G;"":.01z# =,G*3:G !HZ !R2,1;A;"" !A=1A$=" - - I" !A=2A$=" - - YOU" !A$=A$+" WIN " !G(A)=G(A)+1 !N(S(1)-S(2))>30A$=A$+"- DOUBLE GAME ":G(A)=G(A)+1 !2A$=A$+"- - SCORE - "+G(2)+":"+G(1) !3G(2)>G(1)A$=A$+" - YOU ARE WINNING" !2G(1)>G(2)A$=A$+" - YOU ARE LOSING" !-A$=A$+" - - [ PRESS ANY KEY FOR NEW GAME ]" !,#0;A;1,0;A$(32 ) " 10 "300, "A$=A$(2)+A$(1) ". 8700! #CRIB-BOARD------------- # :6 #2,1;"o" #&8,175:239,0 #90,-40(:-240,0:0,40( #&8,167:231,0 #&8,143:231,0 #'16,159:231,0 #'16,151:231,0 #%16,152:0,6 #'47/,174:0,-38& #'87W,174:0,-38& #(127,174:0,-38& #(167,174:0,-38& #(207,174:0,-38& # 7 #҈12 ,8;"5-CARD CRIBBAGE";14,11 ;"BY D J WEST ";16,8;" GAMMA SOFTWARE ";18,14;"1984" # %TABLE------------------ %!#0;1,0,, %&'6,0,,20,0,, %0BF=10 162:F,5;" ";F,25;" ":F %:FF=818:F,8;"  ":F %D`63?,112p:129,0:0,-89Y:-129,0:0,88X %N %SORT------------------- % GIVEN F & A % G=1A %+H(F,G)>100dH(F,G)=H(F,G)-100d %CH(F,G+1)>100dH(F,G+1)=H(F,G+1)-100d %G %Z=0:G=1A %`C(H(F,G),2)>C(H(F,G+1),2)Z=H(F,G):H(F,G)=H(F,G+1):H(F,G+1)=Z %G:Z9645% %ƛH(4,2)F2-C.05|L,10 :#0;1,0,,1,8;"[ PRESS ANY KEY ]":0:#0;1,0,, % %INSTRUCTIONS----------- %:.05|L,22 %1;"FIVE-CARD CRIBBAGE" %\'"The object of this two-player game is to score 61 before your opponent, the Spectrum." %8"The computer deals and keeps score automatically." %('1;2;"DEAL AND DISCARDS" %'"Five cards are dealt to both players from a standard 52-card pack. When the Spectrum has made two discards, you are promp-ted to do likewise:" %)'6;" DISCARDS ?? L" %$'"Type 2 numbers (1-5) and ENTER." %?'"These discards go towards form- ing the 'crib' or 'box'..." % 9900& &91;"THE 'CRIB' AND ";0;"'START'" &F'"The crib is scored to alternate players at the end of each deal."; &"Who gets the first crib is deter-mined at random, and, to offsetany possible dissadvantage, the other player scores 'three for last'." &J'"What you discard depends largelyon whether or not it is your crib." & '"The discards having been made, the 'start' is turned up. This is the card which later becomes common to both hands and the crib. (see 'Show')" & W"If the start is a Jack then who-ever has the crib scores 'two for his heels'." & 9900& &1;2;"THE PLAY" &'"Starting with whoever DOESN'T have the crib, the players take turns in laying their cards, oneby one, on the table, keeping a running-total of the cards' pip-values."; &0" (Aces always count low,J,Q and K count 10)." &{'"This continues until all cards are showing, or no card can be played without making the total more than 31."; & j" The last to play scores 'one for last' unless thetotal is exactly 31 where 2 is scored." '"Scores are made during the Play as follows..." &% 9900& &*#1;2;"PLAY - SCORES" &/'4;"FIFTEEN" &1+"Total pip count = 15 - score 2" &4'4;"PAIRS" &7E"2 cards of the same denominationplayed in turn - score 2" &9'4;"PAIRS ROYAL" &;E"3 cards of the same denominationplayed in turn - score 6" &> '4;"DOUBLE PAIRS ROYAL" &AF"4 cards of the same denominationplayed in turn - score 12" &C'4;"RUNS" &Ep"The last 3 or more cards can be arranged in sequence eg. A32 or JQK - score (no. of cards in run)" &H 9900& &Rn"You play, when prompted, by typ-ing a card number (1-3) and thenENTER. "'"All invalid inputs are ignored." &W'1;2;"THE SHOW" &Z'"Again, starting with the player who doesn't have the crib, the hands are layed on the table, along with the start, evaluated and scored." &\K"Then the crib-holder's hand is scored and, finally, the crib itself." &aO'"Scoring in the Show is similar to that of the Play and goes as follows..." &f 9900& &i#1;2;"SHOW - SCORES" &k@'4;"PAIRS, PAIRS ROYAL AND DOUBLE PAIRS ROYAL" &m+"as Play except cards are in handor crib" &p'4;"FIFTEENS AND RUNS" &u9"as Play except ANY combinations in hand or crib score" &z'4;"FLUSHES" &}C"All cards in hand (exc. start) are the same suit - score 3" &C"All cards in hand (inc. start) are the same suit - score 4" &C"All cards in crib (inc. start) are the same suit - score 5" &'4;"HIS NOBS" &H"Jack (in hand or crib) is the same suit as the start - score 1" & 9900& &"At the end of the Show, you are asked to press a key for the next deal; if you missed a scoreand are unclear about how it wasmade, you can repeat the Show bypressing [ R ]." &'"When a player reaches 61 the game ends. If the loser has scored less than 31, a Double- game or 'lurch' is scored." &!'6;" ======" & 6;" ======" &'"If you're new to the game and/or all is not clear, read these in-structions again and try playinga game, it's probably easier than you think." &y'"If you're new to the game and/or all is not clear, don't worry, the easiest way to learn Crib- bage is to play it." &'"Good luck..." &Z.05|L,10 :#0;1,1;"REPEAT INSTRUCTIONS ? [ Y / N ]":0 &="Y"Ŧ="y":9700% &9100#: &h#0;1,0;" [ PRESS ANY KEY ] ":0:#0;1,0,,:: &======================= &.1}L,1 &"CRIBBAGE"1 &.1}L,1 &"UDGS""A",64@ &.1}L,1 & "CARDS"C() &.1}L,1 & "DIS"X() &.1}L,13 '"" ' """A",64@ ' "CARDS"C() ' ""X() '1,25  4     N A23456789JQKC c AF I SCORE 3 'FOR LAST'  YOU GET FIRST CRIB },& 02azTt&qUDGS @XaB8888|88||8D|8LRRRRL}jUUj}VV8||8}CARDS w4    DIS