home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 49 / 049.d81 / chomp (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  3KB  |  97 lines

  1. 5 poke53280,7:poke53281,7
  2. 10 print"[147]=*=         heuristic chomp          =*=":run5700
  3. 300 ifa(u,v)thengosub7000:return
  4. 310 ifv=1thenx=w
  5. 320 v=l:return
  6. 600 ifpthenprint"[154]                my move [146]     "
  7. 610 u=x:v=y:forc=.to7:poke646,c:print"";:gosub300:a(u,v)=-1:next
  8. 620 foru=xtow:forv=ytol:gosub300:next:next:return
  9. 900 ifi+j+rnd(.)*l*(NULL)>sthenx=i:y=j:s=i+j+rnd(.)*l*(NULL)
  10. 910 return
  11. 1200 ifa(i,j)thengosub900:return
  12. 1210 ifi=1thenj=l
  13. 1220 i=w:return
  14. 1500 s=.:forj=1tol:fori=1tow:gosub1200:next:next:gosub600:return
  15. 1800 fore=.to1step.:ifs>t(n)thenifn<tthenn=n+1:next
  16. 1810 ifs=t(n)thenx=i:y=j:j=l:i=w
  17. 1820 e=1:next:return
  18. 2100 ifa(u,v)thenif(u<iorv<j)thens=s+d:return
  19. 2110 ifu=1thenv=l
  20. 2120 u=w:return
  21. 2400 s=.:d=1:forv=1tol:foru=1tow:gosub2100:next:d=d*10:next:return
  22. 2700 forn=.tot:f=s=t(n):ifs<=t(n)thenn=t
  23. 2710 next:return
  24. 3000 ifa(i,j)thengosub2400:gosub1800:return
  25. 3010 ifj=1theni=w
  26. 3020 j=l:return
  27. 3300 ifrnd(.)>.4thengosub2700:iffthengosub1500:return
  28. 3310 print"[152]            t h i n k i n g  "
  29. 3320 x=.:n=.
  30. 3325 fori=1tow:forj=1tol:gosub3000:next:next:ifx>.thengosub600:return
  31. 3330 gosub1500:return
  32. 3600 print"[144]          -->  your move [146] <--           "
  33. 3610 fore=.to1step.:wait56321,16,16
  34. 3615 x=int((peek(53248)-8)/32)+peek(53264)*8
  35. 3620 ifx<.thennext
  36. 3630 ifx>wthennext
  37. 3640 y=int((peek(53249)-66)/16):ify<.thennext
  38. 3650 ify>h-1thennext
  39. 3660 e=-a(x,y):next
  40. 3665 print"                             ":gosub600:return
  41. 3900 s=t(n):t(n)=t(m):t(m)=s:ifn>rthenn=n-r*2
  42. 3910 return
  43. 4200 ifpthenprint"[156]         i win ... please wait":return
  44. 4210 print"[156]        you win ... please wait":return
  45. 4500 gosub4200:s(p)=s(p)+1:s$=str$(s(.))+" win":ifs(.)-1thens$=s$+"s"
  46. 4510 s$=s$+" "+str$(s(1))+" loss":ifs(1)-1thens$=s$+"es"
  47. 4520 fore=.to1step.:iflen(s$)<34thens$=s$+" "
  48. 4530 iflen(s$)<34thens$=" "+s$
  49. 4540 e=-(len(s$)>=34):next:printy$"=*="s$"=*=";
  50. 4550 ifp=1thenw=w-2:ifw<1thenw=h:l=l-2:ifl<.thenl=.
  51. 4560 forc=1toc(p):forn=.tot:ifm(p,c)=t(n)thent(n)=t(t):n=t:iftthent=t-1
  52. 4570 next:next:p=1-p:forc=1toc(p):f=-1:forn=.tot:ifm(p,c)=t(n)thenf=.:n=t
  53. 4580 next:iffthent=t+1:t(t)=m(p,c)
  54. 4590 next:r=t:fore=.to1step.:r=int(r/2):r=r-(int(r/2)=r/2)
  55. 4600 forb=1tor:forn=btot-rstepr:m=n+r:ifm<=tthenift(n)>t(m)thengosub3900
  56. 4610 next:next:e=-(r=1):next:p=2:return
  57. 4800 ifa(u,v)thens=s+d:return
  58. 4810 ifv=1thenu=w
  59. 4820 v=l:return
  60. 5100 ifa(1,1)=.thenpoke53269,1:gosub4500:return
  61. 5110 s=.:d=1:foru=1tow:forv=1tol:gosub4800:next:d=d*10:next:c(p)=c(p)+1
  62. 5120 m(p,c(p))=s
  63. 5125 gosub2400:c(p)=c(p)+1:m(p,c(p))=s:onp+1gosub3600,3300:return
  64. 5400 print"[144]left button to continue -- right to quit"
  65. 5410 fore=-1to.step.:e=peek(56321)=255:next:ifpeek(56321)=239thenreturn
  66. 5420 poke53269,.:load"menu",8
  67. 5700 fora=.to53288:readn:ifn>255thena=n:readn
  68. 5710 pokea,n:next:sys49408:y$=""
  69. 5720 print"[151]        maximum height (4-9)? ";
  70. 5730 fore=.to1step.:getk$:h=val(k$):e=-(h>3andh<10):next:printk$
  71. 5740 printy$"=*=       point and click left       =*="
  72. 5750 print"[155] from 'commodore magazine'    june 1988[145]";
  73. 5760 dima(9,8),t(666),m(1,72),c(1),s(1):t(.)=1:l=2:poke53269,1
  74. 6000 ifl=hthengosub5400:l=int(h/3)+1
  75. 6010 forw=l+1toh+(l<5)*(h-l*2)
  76. 6020 poke53269,3:print"[149]":forj=1tol:fori=1tow:a(i,j)=-1
  77. 6030 printleft$(y$,j*2+3)tab(i*4-2)"[176][192][192][174][157][157][157][157][173][192][192][189]"
  78. 6040 next:next:c(.)=.:c(1)=.:forp=.to2:ifp=2thenp=.
  79. 6050 gosub5100:next:next:l=l+1:goto6000
  80. 6300 data896,252,,,248,,,240,,,248,,,220,,,142,,,7,,,3,,,,,,,,,,,,,,,,,,
  81. 6310 data,,,,,,,,,,,,,,,,,,,,,,,
  82. 6320 data,252,,49,254,48,49,252,56,251,191,124,221,50,224,10,49,64,3,207,
  83. 6330 data1,206,,,180,,1,74,,2,252,,3,2,,7,7,,124,3,224
  84. 6340 data24,1,192,24,1,128,,,,,,,,,,,,,,,,2040,14,15
  85. 6350 data49408,173,21,3,201,193,240,25,8,120,173,20,3
  86. 6355 data141,,192,173,21,3,141,1
  87. 6360 data192,169,33,141,20,3,169,193
  88. 6365 data141,21,3,40,96,216,173,25,212,172,2,192
  89. 6370 data32,88,193,140,2,192,24,109,,208,141,,208,138,105,,41,1,77,16
  90. 6380 data208,141,16,208,173,26,212,172,3,192,32
  91. 6385 data88,193,140,3,192,56,73,255,109
  92. 6390 data1,208,141,1,208,108,,192,140,5,192,141,4,192,162,,56,237,5,192
  93. 6400 data41,127,201,64,176,7,74,240,18,172,4,192,96,9,192,201,255,240,8,56
  94. 6410 data106,162,255,172,4,192,96,169,,96
  95. 6420 data53248,129,107,46,83,53264,,53280,,7,53287,1,1
  96. 7000 printleft$(y$,v*2+3)tab(u*4-2)"    [157][157][157][157]    ":a(u,v)=.:return
  97.