home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1998 Special / special1988a.d64 / euchre (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  13KB  |  441 lines

  1. 10 gosub1100:gosub1000:gosub2700:gosub1300:gosub10000
  2. 25 gosub2000
  3. 30 iftp<>4then70
  4. 35 pokex,12:pokey,30:sysplt:print"[144]no  bids";
  5. 40 pokex,13:pokey,28:sysplt:print"hand  dumped";
  6. 50 gosub1400:fori=0to4:pokex,19:pokey,i*5+2:sysplt:printec$;:next
  7. 51 dl=fnnp(dl):pokex,7:pokey,12:sysplt:printec$;
  8. 55 gosub1900:goto25
  9. 70 pokex,12:pokey,30:sysplt:print"[144]trump: "co$(tp)s$(tp);
  10. 75 pokex,13:pokey,29:sysplt:print"[144]bidder:";:ifbd=0thenprint"you";:goto90
  11. 80 print" p"right$(str$(bd),1);
  12. 90 print"";:ifku=0then135
  13. 100 ifdl>0then125
  14. 115 pokex,15:pokey,28:sysplt:print"[144]pick discard";
  15. 121 gosub2200:pokex,15:pokey,28:sysplt:print"            ";:goto130
  16. 125 gosub2300
  17. 130 c(dl,f)=kc:s(dl,f)=ks:gosub1220
  18. 135 pokex,7:pokey,12:sysplt:printec$;
  19. 140 gosub2500:gosub3000:if(pw(0)>9)or(pw(1)>9)then300
  20. 150 pokex,21:pokey,31:sysplt:n=0:gosub1465
  21. 151 pokex,21:pokey,35:sysplt:n=0:gosub1465
  22. 200 pokex,7:pokey,31:sysplt:n=pw(0):gosub1465
  23. 205 pokex,7:pokey,35:sysplt:n=pw(1):gosub1465
  24. 210 dl=fnnp(dl):gosub1355:goto25
  25. 300 wt=0:ifpw(1)>=10thenwt=1
  26. 305 pokex,7:pokey,29+wt*6:sysplt:n=1:gosub1465
  27. 310 pokex,7:pokey,31+wt*6:sysplt:n=pw(wt)-10:gosub1465
  28. 315 forde=1to2000:next
  29. 320 gosub1450:pokex,13:pokey,30:sysplt:print"you";
  30. 321 ifwt=0thenprint" win!";
  31. 322 ifwt=1thenprint" lose";
  32. 325 pokex,15:pokey,11:sysplt:print"play again?[146]";
  33. 330 lo=11:hi=12:xp=15:yp=23:gosub1910
  34. 340 ifan=11thenrun
  35. 350 print"[147]";
  36. 999 end
  37. 1000 poke53281,15:poke53280,6:rem setscr
  38. 1005 print"[147]";
  39. 1010 fori=1to24:print"                            [146]            ";:next
  40. 1015 print"                            [146]";
  41. 1020 printspc(28)"[176][195][195][195][195][195][195][195][195][195][195][174]";
  42. 1025 printspc(28)"[194]  euchre  [194]";                                
  43. 1030 printspc(28)"[173][195][195][195][195][195][195][195][195][195][195][189]";
  44. 1031 printspc(28)"            ";
  45. 1032 printspc(28)"   points   [146]";
  46. 1035 printspc(28)" you [167][165]comp ";
  47. 1040 printspc(28)"[183][183][183][183][183][208][207][183][183][183][183][183]";
  48. 1045 fori=1to4:printspc(28)"     [167][165]     ";:next
  49. 1050 printspc(28)"[183][183][183][183][183][183][183][183][183][183][183][183]";
  50. 1051 printspc(28)"[164][164][164][164][164][164][164][164][164][164][164][164]";
  51. 1055 printspc(28)"   tricks   [146]";
  52. 1060 printspc(28)" you [167][165]comp ";
  53. 1065 printspc(28)"[183][183][183][183][183][208][207][183][183][183][183][183]";
  54. 1070 fori=1to3:printspc(28)"     [167][165]     ";:next
  55. 1075 printspc(28)"     [167][165]    ";
  56. 1080 poke2023,32:poke56295,6
  57. 1081 pokex,7:pokey,31:sysplt:gosub1465:pokex,7:pokey,35:sysplt:gosub1465
  58. 1082 pokex,21:pokey,31:sysplt:gosub1465:pokex,21:pokey,35:sysplt:gosub1465
  59. 1090 return
  60. 1100 dim c1$(7),c2$(7),s$(3),dc(23),ds(23),c(3,4),s(3,4),co$(3),cx(3),cy(3)
  61. 1101 dim ob(6),ou(6),pu(6),ms(6,3),ga(6),me$(15),px(3),py(3),nm$(9,2),nf(6)
  62. 1102 dim cl(7,3)
  63. 1108 x=rnd(-ti)
  64. 1109 fori=0to3:reads$(i),co$(i):next
  65. 1110 data"[218]","","[216]","[144]","[211]","","[193]","[144]"
  66. 1111 fori=0to6:readnf(i):next:data4,0,1,2,3,4,0
  67. 1115 fori=0to7:readc1$(i),c2$(i):next
  68. 1120 data"9 "," 9","1o","1o","j "," j","q "," q","k "," k","a "," a"
  69. 1125 data"j "," j","j "," j"
  70. 1130 fori=251to254:readq:pokei,q:next
  71. 1135 data24,76,240,255
  72. 1140 plt=251:x=781:y=782:sx=53248:bl$="            "
  73. 1145 ec$="    [157][157][157][157]":ec$=""+ec$+ec$+ec$+ec$+ec$+"[146]"
  74. 1150 forj=0to3:fori=0to5
  75. 1155 dc(j*6+i)=i:ds(j*6+i)=j
  76. 1160 nexti:nextj
  77. 1161 fori=0to3:readpx(i),py(i):next:data13,12,7,7,1,12,7,17
  78. 1165 fori=0to3:readcx(i),cy(i):next
  79. 1170 data17,11,10,4,3,11,10,21
  80. 1171 fori=0to2:forj=0to9:readnm$(j,i):next:next
  81. 1172 data" [187]","[161][146][161]","[162] ","[162] ","[161][161]"," [162]"," [162]","[162] "," [187]","[172] "
  82. 1173 data" [161]","[161][146][161]"," [162]","[162] ","[188][188]","[162] "," [187]","[146]  "," [187]","[188] "
  83. 1174 data" [190]","[161][146][161]"," [146][162]","[146][162] ","[146] [161]","[146][162] "," [190]","[146]  "," [190]","[146][162] "
  84. 1175 def fnnp(x)=((x+1)/4-int((x+1)/4))*4
  85. 1176 fori=0to5:readcp(i):next:data1,1,8,1,2,-1
  86. 1177 fori=0to13:readme$(i):next
  87. 1178 data"pass    ","order up","pass   ","pick up","  pass    "
  88. 1179 data"[218] diamonds","[216] clubs   ","[211] hearts  ","[193] spades  ","normal    "
  89. 1180 data"aggressive","yes","no ","yes"
  90. 1185 fori=1to3:readmx(i),my(i):next:data7,2,1,10,7,19
  91. 1186 fori=0to6:readob(i),ou(i),pu(i),ms(i,0),ms(i,1),ms(i,2),ms(i,3),ga(i):next
  92. 1187 data99,99,99,99,99,99,99,99
  93. 1188 data99,99,99,99,99,99,99,99
  94. 1189 data99,99,14,14,14,13,13,99
  95. 1190 data20,12,08,08,08,08,07,19
  96. 1191 data14,00,00,00,00,00,00,16
  97. 1192 data00,00,00,00,00,00,00,14
  98. 1193 data00,00,00,00,00,00,00,00
  99. 1199 return
  100. 1200 if(s=tp)and(c=6)thens=s+2:s=(s/4-int(s/4))*4
  101. 1205 printco$(s)c1$(c)"  [157][157][157][157]"s$(s)"   [157][157][157][157]    [157][157][157][157]   "s$(s)"[157][157][157][157]  "c2$(c);
  102. 1207 print"";
  103. 1210 return
  104. 1220 foru=0to4:pokex,19:pokey,u*5+2:sysplt
  105. 1225 c=c(0,u):s=s(0,u):gosub1200:nextu
  106. 1230 return
  107. 1250 fori=0to23:j=int(rnd(1)*24)
  108. 1255 t=dc(i):dc(i)=dc(j):dc(j)=t
  109. 1260 t=ds(i):ds(i)=ds(j):ds(j)=t
  110. 1265 next
  111. 1270 forj=0to3:fori=0to4
  112. 1275 c(j,i)=dc(j*5+i):s(j,i)=ds(j*5+i):next:next:kc=dc(20):ks=ds(20)
  113. 1280 return
  114. 1300 gosub1450:pokex,12:pokey,28:sysplt
  115. 1305 print"[144]first  black";
  116. 1310 pokex,13:pokey,29:sysplt
  117. 1315 print"jack deals";
  118. 1320 gosub1250:dl=0:cc=0
  119. 1325 pokex,cx(dl):pokey,cy(dl):sysplt
  120. 1330 c=dc(cc):s=ds(cc):gosub1200
  121. 1331 forde=1to500:next
  122. 1335 if(dc(cc)=2)and((ds(cc)and253)=1)thengoto1355
  123. 1336 pokex,cx(dl):pokey,cy(dl):sysplt
  124. 1337 forde=1to100:next
  125. 1340 printec$;:cc=cc+1:dl=fnnp(dl):goto1325
  126. 1355 gosub1450:print"[144]";:pokex,12:pokey,29:sysplt
  127. 1356 ifdl=0then1370
  128. 1360 print" player"dl;
  129. 1362 pokex,13:pokey,31:sysplt
  130. 1365 print"deals";:goto1375
  131. 1370 print"your  deal";
  132. 1375 gosub1400
  133. 1376 pokex,cx(dl):pokey,cy(dl):sysplt:printec$;
  134. 1380 return
  135. 1400 pokex,15:pokey,28:sysplt
  136. 1405 gosub6000:print"[144] hit button [146]";:poke198,0
  137. 1410 getwt$:if(wt$<>chr$(13))and(peek(56320)<>111)then1410
  138. 1415 print"";:gosub1450
  139. 1430 return
  140. 1450 forr=12to16:pokex,r:pokey,28:sysplt
  141. 1455 print"            ";:next
  142. 1460 return
  143. 1465 print"";:fori=0to2:printnm$(n,i)"[157][157]";:next:print"[146]";
  144. 1470 return
  145. 1500 fori=0to3:sp(p,i)=fc(pand253):ns(p,i)=0:next
  146. 1505 fori=0to4:s=s(p,i):c=c(p,i):sp(p,s)=sp(p,s)+cp(c):ns(p,s)=ns(p,s)+1
  147. 1510 ifc=2thens=s+2:s=(s/4-int(s/4))*4:sp(p,s)=sp(p,s)+6:ns(p,s)=ns(p,s)+1
  148. 1515 ifc=5thenforj=0to3:sp(p,j)=sp(p,j)+4:nextj
  149. 1520 nexti
  150. 1525 ss=0:fori=0to4:ifns(p,i)=0thensp(p,i)=0:ss=ss+1
  151. 1530 next:fori=0to3:sp(p,i)=sp(p,i)+ss:next
  152. 1535 ifp<>dlthen1550
  153. 1540 ifkc=5thensp(p,ks)=sp(p,ks)+4
  154. 1545 sp(p,ks)=sp(p,ks)+cp(kc):ns(p,ks)=ns(p,ks)+1
  155. 1550 return
  156. 1600 lo=0:hi=1:xp=13:yp=10:gosub1910
  157. 1605 if an=1thentp=ks
  158. 1610 return
  159. 1615 pokex,13:pokey,10:sysplt:print"lonehand?[146]";
  160. 1616 lo=12:hi=13:xp=13:yp=20:gosub1910:lh=0
  161. 1618 ifan=13thenlh=1:pokex,mx(bd)+2:pokey,my(bd):sysplt:print"lonehand[146]";
  162. 1619 pokex,13:pokey,10:sysplt:print"         [146]";
  163. 1620 return
  164. 1625 lh=0:ifsp(p,tp)>ga(ns(p,tp))thenlh=1
  165. 1630 return
  166. 1650 iffnnp(fnnp(p))=dlthengosub1625:f=lh:goto1685
  167. 1654 f=0:ifkc=2thengoto1660
  168. 1655 ifsp(p,ks)>ou(ns(p,ks))thenf=1
  169. 1660 ifsp(p,ks)>ob(ns(p,ks))thenf=1
  170. 1665 if(f=0)or(p<>fnnp(dl))then1685
  171. 1670 sb=cp(kc):ifkc=5thensb=3
  172. 1675 fori=0to3:ifi<>ksthenifsp(p,i)>=(sp(p,ks)-sb)thenf=0
  173. 1680 next
  174. 1685 iff=1thentp=ks
  175. 1699 return
  176. 1700 lo=2:hi=3:xp=13:yp=11:gosub1910
  177. 1705 if an=3thentp=ks
  178. 1710 return
  179. 1750 ifsp(p,ks)>pu(ns(p,ks))thentp=ks
  180. 1755 return
  181. 1800 lo=4:hi=8:xp=13:yp=9:gosub1910
  182. 1801 ifan-5=ksthen1800
  183. 1805 ifan>4thentp=an-5
  184. 1810 return
  185. 1850 df=0:fori=0to3:ifi=ksthen1865
  186. 1855 ifsp(p,i)-ms(ns(p,i),ps)<dfthen1865
  187. 1860 df=sp(p,i)-ms(ns(p,i),ps):tp=i
  188. 1865 next
  189. 1870 return
  190. 1900 fori=1to3:forj=0to2:pokex,mx(i)+j:pokey,my(i):sysplt:print"        ";
  191. 1905 next:next:print"[146]";
  192. 1907 return
  193. 1910 poke198,0:an=lo
  194. 1915 x1=xp:y1=yp:fori=lotohi:print"";
  195. 1920 ifi<>anthen1925
  196. 1921 if(an=lo)or(hi-lo=1)thenprint"";:goto1925
  197. 1922 printco$(i-lo-1);
  198. 1925 pokex,x1:pokey,y1:sysplt:printme$(i);:x1=x1+1:next
  199. 1930 getr$:dr=peek(56320):ifnot((r$="[145]")or(dr=126))thengoto1940
  200. 1935 an=an-1:ifan<lothenan=hi
  201. 1940 ifnot((r$="")or(dr=125))thengoto1950
  202. 1945 an=an+1:ifan>hithenan=lo
  203. 1950 ifnot((r$=chr$(13))or(dr=111))thengoto1915
  204. 1955 x1=xp:y1=yp:print"";:fori=lotohi
  205. 1960 pokex,x1:pokey,y1:sysplt:printleft$(bl$,len(me$(lo)));:x1=x1+1:next
  206. 1965 print"[146]";:return
  207. 2000 gosub1250:gosub1220:p=fnnp(dl):tp=4:bd=0:ku=0
  208. 2005 pokex,7:pokey,12:sysplt:c=kc:s=ks:gosub1200
  209. 2007 ifdl<>0thenpokex,mx(dl):pokey,my(dl)+1:sysplt:print"dealer"
  210. 2010 gosub1500
  211. 2015 ifp=0thengosub1600:goto2040
  212. 2016 ifabs(p-dl)<>2then2020
  213. 2017 gosub1625:iflh=1thentp=ks:goto2025
  214. 2020 gosub1650
  215. 2025 pokex,mx(p):pokey,my(p):sysplt:print"";
  216. 2030 iftp=4thenprint"  pass":goto2040
  217. 2035 bd=p:print"order up";
  218. 2040 p=fnnp(p):if(p<>dl)and(tp=4)then2010
  219. 2045 p=dl:gosub1500:iftp<>4then2105
  220. 2050 ifdl=0thengosub1700:goto2070
  221. 2055 gosub1750:pokex,mx(dl):pokey,my(dl):sysplt:print"";
  222. 2060 iftp=4thenprint" turned[157][157][157][157][157]down";:goto2070
  223. 2065 bd=p:print" picked[157][157][157][157]up";
  224. 2070 forde=1to2000:next
  225. 2071 if(bd=0)and(tp<>4)then2105
  226. 2072 pokex,7:pokey,12:sysplt:printec$;:iftp<>4then2105
  227. 2073 gosub1900:ps=0
  228. 2075 p=fnnp(p)
  229. 2080 ifp=0thengosub1800:goto2090
  230. 2085 gosub1850:pokex,mx(p):pokey,my(p):sysplt:print"";
  231. 2086 forde=1to600:next
  232. 2088 iftp=4thenprint"  pass";:goto2090
  233. 2089 bd=p:printright$(me$(tp+5),8);
  234. 2090 if(p<>dl)and(tp=4)thenps=ps+1:goto2075
  235. 2100 goto2109
  236. 2105 ku=1:if(bd=0)and(dl=2)thenlh=1:goto2120
  237. 2109 iftp=4then2140
  238. 2110 if(lh=1)and(bd<>0)then2120
  239. 2111 ifbd=0thengosub1615:goto2140
  240. 2112 gosub1625
  241. 2115 iflh=0then2140
  242. 2120 pokex,mx(bd)+2:pokey,my(bd):sysplt:print"lonehand";
  243. 2140 print"[146]";:forde=1to2000:next
  244. 2145 gosub1900
  245. 2150 return
  246. 2200 poke198,0:f=-1
  247. 2205 f=f+1:ifc(0,f)=-1then2205
  248. 2210 g=f:pokesx+1,214:pokesx,(f*5+3)*8+22:poke53269,1
  249. 2215 pokesx+1,214:pokesx,(f*5+3)*8+22
  250. 2220 getr$:dr=peek(56320):if(r$="")and(dr=127)then2220
  251. 2225 g=f:ifnot((r$="[157]")or(dr=123))then2250
  252. 2230 f=nf(f):ifc(0,f)<0then2230
  253. 2245 goto2215
  254. 2250 ifnot((r$="")or(dr=119))then2275
  255. 2255 f=nf(f+2):ifc(0,f)<0then2255
  256. 2270 goto2215
  257. 2275 ifnot((r$=chr$(13))or(dr=111))then2215
  258. 2280 return
  259. 2300 fori=0to4:if(s(p,i)=tp)and(c(p,i)=2)thenc(p,i)=7:goto2310
  260. 2305 if((s(p,i)and253)=(tpand253))and(c(p,i)=2)thenc(p,i)=6:s(p,i)=tp
  261. 2310 next
  262. 2315 fori=0to4:forj=0to3:ifs(p,j)>s(p,j+1)thengoto2331
  263. 2320 ifs(p,j)=s(p,j+1)thenifc(p,j)>c(p,j+1)thengoto2331
  264. 2325 t=c(p,j):c(p,j)=c(p,j+1):c(p,j+1)=t
  265. 2330 t=s(p,j):s(p,j)=s(p,j+1):s(p,j+1)=t
  266. 2331 next
  267. 2335 fori=0to4:pt(i)=0:ifs(p,i)=tpthenpt(i)=c(p,i)+10:goto2350
  268. 2340 ifc(p,i)=5thenpt(i)=9:goto2350
  269. 2345 if(s(p,i)<>s(p,nf(i)))and(s(p,i)<>s(p,nf(i+2)))thenpt(i)=-1
  270. 2350 next
  271. 2355 l=99:fori=0to4:ifpt(i)<lthenf=i:l=pt(i)
  272. 2360 next:return
  273. 2500 fori=0to3:forj=0to3:ns(i,j)=0:next:forj=0to4:ifc(i,j)<>2then2515
  274. 2505 ifs(i,j)=tpthenc(i,j)=7:goto2515
  275. 2510 ifabs(s(i,j)-tp)=2thenc(i,j)=6:s(i,j)=tp
  276. 2515 ns(i,s(i,j))=ns(i,s(i,j))+1:next:next
  277. 2520 return
  278. 2700 print"partner?[146]";:lo=9:hi=10:xp=2:yp=12:gosub1910
  279. 2705 fc(0)=0:ifan=10thenfc(0)=2
  280. 2710 print"opponents?[146]";:lo=9:hi=10:xp=2:yp=14:gosub1910
  281. 2715 fc(1)=0:ifan=10thenfc(1)=2
  282. 2720 print"          [146]";:return
  283. 3000 fori=0to7:forj=0to3:cl(i,j)=0:next:next:cl(2,tpand253)=1
  284. 3001 fori=0to3:sl(i)=0:next
  285. 3002 ld=fnnp(dl):dm=4:tr(0)=0:tr(1)=0:iflh=0then3015
  286. 3005 ifbd=2thenfori=0to4:pokex,19:pokey,i*5+2:sysplt:printec$;:next
  287. 3010 dm=fnnp(fnnp(bd))
  288. 3011 iflh=1thenifld=dmthenld=fnnp(ld)
  289. 3015 fortk=0to4:p=ld:ps=0:tl=0:ifdm=pthenp=fnnp(p)
  290. 3020 gosub3500:wp=p:iflh=1thenps=ps+1
  291. 3021 sl(s(p,pc(p)))=1
  292. 3025 ifs(p,pc(p))=tpthentl=1
  293. 3030 fori=1to3:p=fnnp(p):ifp=dmthen3060
  294. 3035 ps=ps+1:gosub3500:iftl=0then3050
  295. 3040 ifs(p,pc(p))=tpthenifc(p,pc(p))>c(wp,pc(wp))thenwp=p
  296. 3045 goto3060
  297. 3050 ifs(p,pc(p))=tpthenwp=p:tl=1:goto3060
  298. 3055 ifs(p,pc(p))=s(wp,pc(wp))thenifc(p,pc(p))>c(wp,pc(wp))thenwp=p
  299. 3060 next:forde=1to400:next
  300. 3065 pokesx+3,(px(wp)+1)*8+52:pokesx+2,(py(wp)+1)*8+19:poke53269,2
  301. 3071 forde=1to3000:next:ld=wp:wt=wpand253:tr(wt)=tr(wt)+1
  302. 3072 pokex,21:pokey,31+4*wt:sysplt:n=tr(wt):gosub1465:poke53269,0
  303. 3075 fori=0to3:pokex,px(i):pokey,py(i):sysplt:printec$;:c(i,pc(i))=-1:next:next
  304. 3078 pokex,mx(bd)+2:pokey,my(bd):sysplt:print"         [146]";
  305. 3080 bt=bdand253:pokex,15:pokey,28:sysplt
  306. 3085 print"[144]";:iftr(bt)<3then3108
  307. 3086 iftr(bt)<5then3097
  308. 3087 pw(bt)=pw(bt)+2+lh*2
  309. 3090 ifbt=0thenprint"  you  won[157][157][157][157][157][157][157][157][157]all tricks";:goto3200
  310. 3095 ifbt=1thenprint"computer won[157][157][157][157][157][157][157][157][157][157][157]all tricks";:goto3200
  311. 3097 pw(bt)=pw(bt)+1
  312. 3100 iftr(0)>2thenprint"you won hand";:goto3200
  313. 3105 iftr(1)>2thenprint"  computer[157][157][157][157][157][157][157][157]won hand";:goto3200
  314. 3108 pw(1-bt)=pw(1-bt)+2
  315. 3110 iftr(0)<3thenprint"you've  been[157][157][157][157][157][157][157][157][157][157]euchred!":goto3200
  316. 3115 iftr(1)<3thenprint"  computer[157][157][157][157][157][157][157][157]euchred!";:
  317. 3119 forde=1to4000:next
  318. 3200 forde=1to4000:next:print"";
  319. 3205 return
  320. 3500 ifp>0then3509
  321. 3501 pokex,15:pokey,28:sysplt
  322. 3502 print"[144] your  play [146]";:gosub2200
  323. 3503 ls=s(ld,pc(ld)):if(ps=0)or(s(p,f)=ls)or(ns(p,ls)=0)then3507
  324. 3504 gosub2215:goto3503
  325. 3505 poke53269,0:pokex,19:pokey,f*5+2:sysplt:printec$;:goto3530
  326. 3507 pokex,15:pokey,28:sysplt:print"            "
  327. 3508 poke53269,0:pokex,19:pokey,f*5+2:sysplt:printec$;:goto3530
  328. 3509 iftk<5then3515
  329. 3510 fork=0to4:ifc(p,j)>-1thenf=i
  330. 3512 next:goto3530
  331. 3515 on(ps+1)gosub4000,4100,4200,4200
  332. 3530 pc(p)=f:pokex,px(p):pokey,py(p):sysplt:c=c(p,f):s=s(p,f):gosub1200
  333. 3535 ns(p,s(p,f))=ns(p,s(p,f))-1:cl(c(p,f),s(p,f))=1
  334. 3540 return
  335. 4000 ifnot(ns(p,tp)=5-tk)then4015
  336. 4005 sp=tp:gosub5200:iff=1thengoto5150
  337. 4010 goto5160
  338. 4015 ifnot((lh=1)and(bd=p))thengoto4030
  339. 4020 ifns(p,tp)>0thensp=tp:goto5150
  340. 4025 goto5050
  341. 4030 gosub5000:if(f=1)and(abs(bd-p)=2)thensp=tp:goto5150
  342. 4035 gosub5250:ifnot((f=1)and(p=bd))thengoto5050
  343. 4040 gosub5200:iff=1thensp=tp:goto5150
  344. 4045 ifns(p,tp)>2thensp=tp:goto5160
  345. 4050 goto5050
  346. 4100 ifns(p,s(ld,pc(ld)))=0then4115
  347. 4105 gosub5300:sp=s(ld,pc(ld)):iff=1then5150
  348. 4110 goto5160
  349. 4115 ifns(p,tp)=5-tkthensp=tp:goto5160
  350. 4120 ifns(p,tp)=0then5100
  351. 4125 ifc(ld,pc(ld))=5thensp=tp:goto5160
  352. 4130 ifbd<>pthensp=tp:goto5160
  353. 4135 gosub5250:iff=1thensp=tp:goto5160
  354. 4140 goto5100
  355. 4200 ifns(p,s(ld,pc(ld)))=0then4235
  356. 4201 sp=s(ld,pc(ld))
  357. 4205 if(sp<>tp)and(tl=1)then5160
  358. 4210 ifabs(wp-p)<>2then4225
  359. 4215 gosub5300:iff=1thengosub5350:iff=0then5150
  360. 4220 goto5160
  361. 4225 gosub5300:iff=1then5150
  362. 4230 goto5160
  363. 4235 ifns(p,tp)<5-tkthen4270
  364. 4245 sp=tp:ifabs(wp-p)=2then5160
  365. 4250 iftl=0then5160
  366. 4255 gosub5300:iff=1thengoto5400
  367. 4260 goto5160
  368. 4270 ifns(p,tp)=0thengoto5100
  369. 4275 ifabs(wp-p)<>2then4310
  370. 4280 if(tl=1)or(ps=3)then5100
  371. 4285 ifc(wp,pc(wp))=5then5100
  372. 4290 ifc(wp,pc(wp))<4thensp=tp:goto5160
  373. 4300 gosub5250:iff=1thensp=tp:goto5160
  374. 4305 goto5100
  375. 4310 iftl=0thensp=tp:goto5160
  376. 4315 gosub5300:iff=1thensp=tp:goto5400
  377. 4320 goto5100
  378. 5000 f=0:fora=0to4:ifc(p,a)>5thenf=1
  379. 5005 next:return
  380. 5050 f=-1:fora=0to4:if(sl(s(p,a))=0)and(s(p,a)<>tp)thenifc(p,a)=5thenf=a
  381. 5055 next:iff>-1then5070
  382. 5060 lc=-1:fora=0to4:ifs(p,a)<>tpthenifc(p,a)>lcthenlc=c(p,a):f=a
  383. 5065 next
  384. 5070 return
  385. 5100 ifns(p,tp)>0then5125
  386. 5105 sp=-1:fora=0to4
  387. 5110 ifs(p,a)<>tpthenif(c(p,a)=5)and(ns(p,s(p,a))>1)thensp=s(p,a)
  388. 5115 next:ifsp>-1then5160
  389. 5120 goto5180
  390. 5125 v=4:f=-1:fora=0to4
  391. 5126 ifs(p,a)=tpthen5135
  392. 5130 if(ns(p,s(p,a))<>1)or(sl(s(p,a))=1)then5135
  393. 5131 if(c(p,a)>=0)and(c(p,a)<v)thenv=c(p,a):f=a
  394. 5135 next:iff=-1then5180
  395. 5140 return
  396. 5150 ifps=3then5400
  397. 5151 v=-1:fora=0to4:ifs(p,a)=spthenifc(p,a)>vthenv=c(p,a):f=a
  398. 5155 next:return
  399. 5160 v=10:fora=0to4
  400. 5161 ifs(p,a)=spthenif(c(p,a)>=0)and(c(p,a)<v)thenv=c(p,a):f=a
  401. 5165 next:return
  402. 5180 v=10:fora=0to4:ifs(p,a)<>tpthenifc(p,a)>-1thenifc(p,a)<vthenv=c(p,a):f=a
  403. 5185 next:return
  404. 5200 ht=8:f=0
  405. 5205 ht=ht-1:ifht>0thenifcl(ht,tp)=1then5205
  406. 5210 ifht<0then5240
  407. 5215 fora=0to4:ifs(p,a)=tpthenifc(p,a)=htthenf=1
  408. 5220 next
  409. 5240 return
  410. 5250 f=1:fora=0to4:ifc(p,a)>-1thenif(s(p,a)<>tp)and(c(p,a)<5)thenf=0
  411. 5255 next:return
  412. 5300 f=0:fora=0to4:ifs(p,a)=s(wp,pc(wp))thenifc(p,a)>c(wp,pc(wp))thenf=1
  413. 5305 next:return
  414. 5350 f=0:fora=0to4:ifs(p,a)=s(wp,pc(wp))thenifc(p,a)-c(wp,pc(wp))=1thenf=1
  415. 5355 next:return
  416. 5400 d=10:fora=0to4
  417. 5405 ifs(p,a)=s(wp,pc(wp))thene=c(p,a)-c(wp,pc(wp)):if(e<d)and(e>0)thend=e:f=a
  418. 5410 next:return
  419. 6000 forr=54272to54296:poker,0:next:poke54275,1
  420. 6010 poke54277,21:poke54278,135:poke54273,150:poke54276,17
  421. 6020 forr=15to0step-.2:poke54296,r:next
  422. 6030 poke54276,16:poke54296,0:return
  423. 10000 poke53285,13:poke53287,11:poke53288,5:poke53276,2:poke2040,13:poke2041,14
  424. 10010 sa=832:forj=0to1:sa=sa+j*64:fori=0to63:reada:pokesa+i,a:next:next:return
  425. 10050 data 0,96,0,6,108,0,6,108
  426. 10051 data 0,6,109,128,3,109,128,3
  427. 10052 data 253,128,27,255,0,13,255,0
  428. 10053 data 15,255,0,7,254,0,3,254
  429. 10054 data 0,1,252,0,0,252,0,0
  430. 10055 data 252,0,0,0,0,0,0,0
  431. 10056 data 0,0,0,0,0,0,0,0
  432. 10057 data 0,0,0,0,0,0,0,190
  433. 10060 data 10,170,168,10,149,168,10,85
  434. 10061 data 104,9,89,88,9,106,152,9
  435. 10062 data 153,88,9,153,88,9,153,88
  436. 10063 data 9,153,88,9,106,88,9,89
  437. 10064 data 152,9,89,152,9,89,152,9
  438. 10065 data 89,152,9,170,88,9,89,88
  439. 10066 data 10,85,104,10,149,168,10,170
  440. 10067 data 168,0,0,0,0,0,0,0
  441.