ZXTape!Cribbage DD:D(0t(x)=(x>9 )*10 +(x<10 )*x 2s(xfff)=10 *(x-x) < 7000X 87,8;1;"THINKING";0,0; 5i=15 :j=i+16 ?$y=1:tot=0:f5=0 Dx=16 Ix=ix=j610b N1h(y)=c(x):i(y)=d(x):h$(y)=c$(x):tot=tot+i(y) Si(y)=5f5=f5+1 X y=y+1 bx l evalhand vs=s+p+f+fl+f5:cr=0 )c(j)=c(i)c(j)=c(i)+1cr=2 *c(i)=5d(j)=5cr=cr+2 #d(i)+d(j)=15cr=cr+2 <debug:q=14:h(q);" ";:q:,s;" ";cr;" ";  dlr=1s=s+cr:665 s=s-cr 7s>maxmax=s:t(1)=i:t(2)=j:debug"x"; j:i  y=0 x=t(1):erase x=t(2):erase 7,8;" READY "  ."p=0:f=0:fl=4 Vtot=15f=2 `x=1c-1 jy=x+1c th(x)=h(y)p=p+2 ~!i(x)+i(y)=15f=f+2 c<51220  t=0  z=1c z=xz=y1200  t=i(z)+t z t=15f=f+2 y:x x=14  tot-i(x)=15f=f+2 h$(x)h$(1)fl=0 x c=41400x  &tot-i(5)=15f=f+2 0fl=4h$(5)=h$(1)fl=5 %fl=4crib=1fl=0 xx=1:s=0  x>3 r=1:d=1 4h(x+1)=h(x)+1r=r+1:1490 h(x+1)>h(x)1470 $d=d+1:d31490 h(x-1)h(x)d=4  1490 #r>rlens=s+d*r:r=2s=s-d x=x+1:1410 x=x+1:xrlens=s+d*r:r=2s=s-d  p=0:s=0  ct=t(c) tot+ct>31s=-1: n=n+1:t(n)=c ,t=tot+ct:t=15t=31s=2  n=1 (t(n-1)-c)n x=n-11-1 t(n)t(x)21004  p=p+2  x 4p=6p=12 >p=4p=6 Cs=s+p H p>0  n<3  l=3n  y=1 x=n-l+1n h(y)=t(x):y=y+1 x sort r=l $x=1l-1 .'h(x)+1h(x+1)2380L 8x B r>pp=r Ll Qs=s+p V j z=0 tx=1l-1 ~>h(x)>h(x+1)z=h(x):h(x)=h(x+1):h(x+1)=z x z02410j  8nh=4hgo=1:6,9 ;" Go ": /m$="Select a card using SPACE+ENTER":message c=4:x=1:select b(x)02765 tot<222720 #20,x*4-4;"Go?" .m$="ENTER again if you can't play.":message hgo=x:select &20,hgo*4-4;" "; hgox2740 tot15)-(t=21)+(tsafe)-2*(t=5) n>03400H j=14 i=jd(j)<03360 (t5t+d(j)=15s=s+2  (c-c(j))<2s=s+2 j 4 3450z H(t(n)-c)>23450z Rj=14 \j=id(j)<03440p f<(t(n)-c(j))2t+2*d(i)<32 s=s+2 pj zs=s+(>.6) smaxmax=s:x1=i (debug#1;c;"=";i(i);",";s;" "; i 7x1=0cgo=1:6,9 ;" Go ": c=c(x1):t=tot+t(c) n=n+1:t(n)=c tot=t:s=i(x1) nc=nc+1:d(x1)=-9 x=nc:y=0 x$=r$(c):y$=c$(x1) $.02{# =,12 :faceup . player=zx 8total ~ 4 +21,x*4-3;1;"^"; ""3725 =13 3800 " "3730 "21,x*4-3;" "; x=x+1:x>cx=1  3720 "21,x*4-3;" ";  nh=0:nc=0 safe=31  44000 dlrzx4200h done=1  manplay win>0 "&tot=314300:4200h ,cgo=04200h 6hgo=04100 @!s=1:total:win>0 J 4300 mdone=1 rzxplay |win>0 &tot=314300:4100 hgo=04100 cgo=04200h !s=1:total:win>0  4300  4100  y=0 x=1nc  facedown x  y=8 x=1nh  facedown x 5done=0:s=0 Dtot=0:n=0 N%nh=4nc=4done=1 Xcgo=0:hgo=0 b total: #1;0,0;n$; c=5:rlen=2 x=18:clear dlr=zx4600 x=15 h(x)=c(x):h$(x)=c$(x) x up=1:c=4:zxhand  m$="Counting my hand":message player=zx:count win dlr=zx46604 "m$="Counting your hand":message x=15 h(x)=a(x):h$(x)=a$(x)  x c=4:y=11  manhand  player=man:count %win *dlr=zx4540 4&m$="Ready to see the crib?":message 5 0 9x=18:clear > cribhand C+m$="Counting points in the crib":message Hcount R anob=0:tot=0 fx=15 k8x<5h(x)=11 h$(x)=e$(5)nob=1 pi(x)=t(h(x)) tot=tot+i(x) x l=5:sort c=5:evalhand  m$="":message player=zxmug4820 "What is your score? ";ss $ss<0ss>5024780 1ss=s+p+f+fl+nobm$="I agree":s=ss:4880 Hss=19s+p+f+fl+nob=0m$="I agree!":s=0:4880 'm$=ss+" is WRONG, I get the points!" mug=2:player=zx  4 f>0"15s - ";f;" "; p>0"pairs- ";p;   fl>0"flush- ";fl;" "; s>0"runs - ";s;  "nob=1"and 1 for his nob"  s=s+p+f+fl+nob "Total = ";s; mug=2" for me!" message:update 1mug=2player=man:mug=1:100d  )y=8:facedown .m$="Now I cut the pack." 3+player=manmessage:502:4930B 8.m$="Press any key to cut the pack.":message ==""4925= Br=*40(+12.5H G k=p(r) Lk=s4930B Qk$=s$(s(p(r))) Vx$=r$(k):y$=k$ [x=x-.25~:y=7 `faceup ea(5)=k:a$(5)=k$ jc(5)=k:c$(5)=k$ oe(5)=k:e$(5)=k$ t ye(5)=k:e$(5)=k$  x=1c x$=r$(a(x)):y$=a$(x) faceup x:  y=0  x=1c  x$=r$(c(x)):y$=c$(x) faceup 2x: Z-crib=1:y=11 :dlr=zxy=0 dx=15 nh(x)=e(x):h$(x)=e$(x) xx$=r$(e(x)):y$=e$(x) x<5faceup x: 4:5370  2 x$=" ":y$=x$:5420, "17:y$=s$(1)y$=s$(3)2 ,x1=4*x-4 @%y,x1;x$;" ";y+1,x1;y$;" " J+y+2,x1;" ";y+3,x1;" ";y$ Ty+4,x1;" ";x$ ^4:0: 2#1;1,0;n$;1,0;m$  4:0,0; y=122:x:y :0,0: N&0,25;6;"You ZX" S25;6;" " Xy=16 b25;6;" " l25;6;" " v25;6;" " y 25;6;" " n$;:6 .2,28;"";19,28;"" m$="CRIBBAGE" x=18 #2*x+1,28;m$(x) x 1,0;:4: u s=0 z.2~L,10  s=0 ss=v(player) ss>06400 v(player)=s(player) s(player)=s(player)+s -s(player)>120xwin=player:6085 ss=s(player)  6400 $6;20,25;s(man) D6;20,31-(s(zx)>99c)-(s(zx)>9 );s(zx)  x=25:v=1 "player=zxx=31:v=3  ss>60<ss=ss-60< )ss<31ss=31-ss:6440( Iss=ss-30:x=27:v=3:player=zxx=29:v=1 (0y=1+(ss+((ss-1)/5))/2 2!yɺyy=y+1:v=v+1 <1;6;y,x;v$(v) Z ]:debug=0 b4:4:0: l7x=0:y=0:z=0:i=0:j=0 q%h(8):h$(6):i(6) v%a(6):a$(6):b(6) {%c(6):c$(6):d(6) e(6):e$(6) 1g(2):s(2):v(2):v$(5) p(524):t(12 ) 9"Welcome to CRIBBAGE."'"Do you want instructions? ";i$ i$=""7075 9i$(1)="y"i$(1)="Y"9000(#:7080 +#1;"Please wait for a few moments." x=113 :k$ y=07:z  k$+y,z y:x pick2=500 evalhand=1000 laycard=2000 sort=2400` manplay=2700 total=2900T zxplay=3200 select=3700t taketurns=4000 show=4500 count=4700\ cut=4900$ manhand=5000 zxhand=5100 cribhand=5200P erase=5300  facedown=5350 faceup=5400 message=5500| clear=5600  drawboard=5700D *update=6000p zx=1:man=2  v$=""  s$="" r$="A23456789JQK" 'n$=" "  o$="Press any key to continue" i$="y"9050Z#  z=0 x=113 y=.1}L.4L.1}L z=z+1:p(z)=x+y y x g(man)=0:g(zx)=0  mug=0 ="With muggins rule (y/n)? ";m$:m$="y"m$="Y"mug=1  drawboard /#1;0,0;"Lowest cut deals." Gs(zx)=0:s(man)=0:v(1)=0:v(2)=0 +dlr=zx:s=0:player=zx:win=0 x=2:cut:s=k  502 player=man:x=5:cut sp(x+1)z=x:j=p(x):p(x)=p(x+1):p(x+1)=j x:z>07655  y i=0:j=16 (dlr=zxi=16:j=0 2x=16 <y=i:facedown F c(x)=p(x):c$(x)=s$(s(p(x))) Pd(x)=t(c(x)) Zy=j:facedown d0a(x)=p(x+6):a$(x)=s$(s(p(x+6))) nb(x)=1 sx x c=6:y=16:manhand }debugzxhand 0m$="Please wait while I pick 2 cards":message 'c=4:rlen=1:crib=0 7max=-99c:t(1)=1:t(2)=6 pick2 .m$="Pick 2 cards using SPACE+ENTER":message  i$="y"9300T$:9400$ "c=6:y=16:x=1 select:facedown t(3)=x:select x$=r$(a(x)):y$=a$(x) "x=t(3)faceup:7860 t(4)=x:facedown x=12 e(x)=c(t(x)):e$(x)=c$(t(x)) c(t(x))=0 >e(x+2)=a(t(x+2)):e$(x+2)=a$(t(x+2)) a(t(x+2))=0 x y=1:z=1 x=16 c(x)=07955  c(y)=c(x):d(y)=d(x) c$(y)=c$(x):y=y+1 a(x)=07970" %a(z)=a(x):a$(z)=a$(x):z=z+1 "x ,x=24:clear 1i$="y"9450$ 6#0;0,0;n$ @s=0:player=dlr Jx=6:cut THk=11 m$="2 for his heels":message:s=2:update:40( ^ c=4 hy=16:manhand r taketurns |win8200 i$="y"9200# show win8200 (m$="Ready for the next hand?":message =""8105 +dlr=dlr+1:dlr>2dlr=1 x=25:clear i$"y"7500L $"Continue with instructions? ";i$ i$="Y"i$="y"  7500L %m$="Congratulations, you have won!" %win=zxm$="Hard luck, I have won!" &#1;0,0;m$ 026;18,28;1;v$(5) :,x=160<2:.02{# =,x:x Dg(player)=g(player)+1 Im$=o$:message N 0 Xx=23:clear b54,8;"SCORE";5,7;"_______" l 7,8;"You ";g(man) v9 ,8;"ZX ";g(zx) "Another game (y/n)? ";m$ m$="n"m$="N"10000' 7400 #-i$="y" #2:" 6 card Cribbage is a game for 2 players. Each is dealt 6 cards2 of which he discards to form a third hand (the crib) which islater scored by the dealer. The 3 hands are complemented by a card cut from the pack." #31) then select"'"an empty card position." %:m$=o$:message %D0:x=25:clear %v %M"a",0,195,195,0,0,195,195,0 %I"b",0,195,195,0,0,0,0,0 %P"c",568,568,254,254,214,16,16,568 %Q"d",16,568,124|,254,254,124|,568,16 %G"e",0,24,24,0,0,0,0,0 %K"f",240,255,240,0,0,0,0,0 %K"g",0,0,0,0,240,255,240,0 & Q"h",68D,238,254,124|,124|,568,16,16 & I"i",15,255,15,0,0,0,0,0 &4I"j",0,0,0,0,15,255,15,0 &HI"k",28,28,28,28,8,8,8,8 &\Q"s",16,568,124|,254,254,146,16,568 &pL"t",0,76L,210,82R,82R,82R,76L,0 W