home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 35 / 035.d81 / mindbender (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  192 lines

  1. 1 poke53281,1:poke53280,2:gosub4050
  2. 70 at=679:for i=at to at+22:readx:pokei,x:next
  3. 72 poke198,0:wait198,1:poke198,0
  4. 74 print"[147]":as=3:mm=1:goto890
  5. 80 data32,180,2,132,251,32,180,2
  6. 90 data166,251,76,240,255,32,253,174
  7. 100 data32,158,173,32,170,177,96
  8. 110 pokevo,15:pokewv,17:pokeak,15:pokehi,58:pokelo,149
  9. 120 fortm=1to100:nexttm:pokewv,0
  10. 130 pokewv,17:pokehi,34:pokelo,75:fortm=1to100:nexttm:pokewv,0:return
  11. 140 :
  12. 150 sys at,1,14:printchr$(142)"[151]mindbender[146]";
  13. 155 if(mm)thensys at,24,12:print"[144][sample screen]":mm=.:goto160
  14. 157 sys at,24,14:print"[144][f7 quits]"
  15. 160 er=0:co$="":ro$="":ct=fre(0)
  16. 170 sys at,4,13:print"[144]a[146]  b[146]  c[146]  d[146]  e[146]";
  17. 180 sys at,6,12:printa$(b(1))u$a$(b(4))u$a$(b(7)):sys at,7,10:print"[144]1 ";
  18. 190 if val(f2$)=1 thengosub110
  19. 200 sys at,9,12:printa$(b(2))u$a$(b(5))u$a$(b(8)):sys at,10,10:print"[144]2 ";
  20. 210 if val(f2$)=2 thengosub110
  21. 220 sys at,12,12:printa$(b(3))u$a$(b(6))u$a$(b(9))u$a$(b(12))u$a$(b(15))
  22. 230 if val(f2$)=3 thengosub110
  23. 240 sys at,13,10:print"[144]3 ";:sys at,15,30:print"[144]move #";
  24. 250 sys at,15,18:printa$(b(10))u$a$(b(13))u$a$(b(16)):sys at,16,10:print"[144]4 ";
  25. 260 if val(f2$)=4 thengosub110
  26. 270 sys at,18,18:printa$(b(11))u$a$(b(14))u$a$(b(17)):sys at,19,10:print"[144]5 ";
  27. 280 if val(f2$)=5 thengosub110
  28. 290 ifd$=e$thener=3:goto760
  29. 300 if as=0 or as=3 then320
  30. 310 zz=zz+2:cr$=mid$(slv$,zz,2):co$=left$(cr$,1):ro$=right$(cr$,1)
  31. 312 geta$:ifa$="[136]"thengosub2000
  32. 315 goto410
  33. 320 sys at,22,9:print"enter move [col[146],row]:   [157][157]";:poke198,0
  34. 330 if as<>3then340
  35. 331 fortm=1to2500
  36. 332 ifpeek(198)<>0thentm=2500
  37. 334 nexttm
  38. 335 print"[147]":poke53281,0:goto1130
  39. 340 poke198,0:wait198,1:getco$
  40. 342 ifco$<>"[133]"andco$<>"[136]"andco$>"z"thenco$=chr$(asc(co$)-128)
  41. 350 fori=1to7:ifco$=mid$("[133][136]abcde",i,1)thenprint""co$"[146]";:poke198,0:goto370
  42. 360 next:goto340
  43. 370 ifco$="[133]"then as=1:goto990:rem - autosolve
  44. 380 ifco$="[136]"thengosub2000:goto320
  45. 390 getro$:fori=1to7:ifro$=mid$("[133][136]12345",i,1)thenprintro$;:goto410
  46. 400 next:goto390
  47. 410 ifro$="[136]"thengosub2000:goto320
  48. 412 ifro$="[133]"then as=1:goto990:rem - autosolve
  49. 415 co=asc(co$)-64:ro=val(ro$):f2$=ro$:
  50. 420 if as=1then sys at,22,31:print""co$;"[146]"ro$;:cr$=""
  51. 430 ifco=1orco=2thenifro=4orro=5thener=1:goto760:rem - error rtn.
  52. 440 ifco=4orco=5thenifro=1orro=2thener=1:goto760
  53. 450 h=(co*10)+ro:f1=h:gosub640:ifer=1then760
  54. 460 fr=h:fori=1to17:ifmid$(d$,i,1)="3"thenh=i:tu=h
  55. 470 next:gosub700:t1=h
  56. 480 :
  57. 490 if abs(f1-t1)=9 or abs(f1-t1)=11 then er=1:goto760
  58. 500 if c(fr)=3 then er=2:goto760
  59. 510 if f1>t1 then550
  60. 520 if abs(f1-t1)=20 and c(fr)=c(fr+3) thener=1:goto760
  61. 530 if abs(f1-t1)=2 and c(fr)=c(fr+1)thener=1:goto760
  62. 540 goto570
  63. 550 if abs(f1-t1)=20 and c(fr)=c(fr-3)thener=1:goto760
  64. 560 if abs(f1-t1)=2 and c(fr)=c(fr-1)thener=1:goto760
  65. 570 ft=abs(fr-tu)
  66. 580 if ft<>1 and ft<>2 and ft<>3 and ft<>6 then er=1:goto760
  67. 590 :
  68. 600 c=c(tu):c(tu)=c(fr):c(fr)=c
  69. 610 d$="":forx=1to17:d$=d$+right$(str$(c(x)),1):next
  70. 620 forx=1to17:b(x)=c(x):next
  71. 630 mv=mv+1:mv$="":mv$=str$(mv):sys at,17,31:print mv$;:goto150
  72. 640 ifh>=11thenifh<=13thenh=h-10:return
  73. 650 ifh>=21thenifh<=23thenh=h-17:return
  74. 660 ifh>=31thenifh<=35thenh=h-24:return
  75. 670 ifh>=43thenifh<=45thenh=h-31:return
  76. 680 ifh>=53thenifh<=55thenh=h-38:return
  77. 690 er=1:return
  78. 700 ifh<=3thenh=h+10:return
  79. 710 ifh<=6thenh=h+17:return
  80. 720 ifh<=11thenh=h+24:return
  81. 730 ifh<=14thenh=h+31:return
  82. 740 h=h+38:return
  83. 750 :
  84. 760 if as=1 then er=5
  85. 770 b1=770+(er*10):poke785,188:poke786,168:pokeb1,peek(b1):b1=usr(0)
  86. 780 er$="[144]illegal entry[146]":goto830
  87. 790 er$="[144]position empty[146]":goto830
  88. 800 er$="[144]congratulations!![146]":goto830
  89. 810 er$="[144]thanks for playing. 'bye.[146]":goto830
  90. 820 er$="[144]puzzle solved![146]"
  91. 830 c=(22-len(er$)/2):sys at,24,c:printer$;
  92. 831 poke54296,15:form=1to3:forz=70to100step5
  93. 833 poke54273,z
  94. 834 poke54272,.
  95. 835 poke54277,15
  96. 836 poke54278,10
  97. 837 poke54276,17
  98. 838 next:next:poke54276,.
  99. 850 poke781,24:sys59903:er$="":f2$="":ifer<3then150
  100. 860 if as<>2 then870
  101. 861 goto3010
  102. 870 er=4:as=2:goto770
  103. 880 :
  104. 890 dim a$(3),b(17),c(17)
  105. 900 :
  106. 910 u$="[145][145]"
  107. 920 a$(1)="   [146][157][157][157] [146][144][209] [146][157][157][157]   [146]"
  108. 930 a$(2)="   [146][157][157][157] [146][209] [146][157][157][157]   [146]"
  109. 940 a$(3)="   [157][157][157] [158]  [157][157][157]   [146]"
  110. 950 e$="22222222311111111":rem - solution format
  111. 960 :
  112. 970 vo=54296:wv=54276:ak=54277:hi=54273:lo=54272:f2=0:f2$=""
  113. 980 :
  114. 990 d$="11111111322222222":rem - puzzle format
  115. 1000 for x=1 to 17:b(x)=val(mid$(d$,x,1)):c(x)=b(x):next
  116. 1010 if as=3 then1080
  117. 1020 mv=0:zz=-1:f2$="":sys at,17,31:print"  ";
  118. 1030 :
  119. 1040 slv$="d3b3a3c3c4c2c1c3c5d5d3b3c3e3e4c4c2b2b3b1a1a3c3"
  120. 1050 slv$=slv$+"e3e5d5d3d4c4c2a2a3c3d3b3b1c1c3c5c4c2c3e3d3b3c3"
  121. 1060 print"";:goto150
  122. 1070 :
  123. 1080 poke53281,0:sys at,1,14:print"[205][201][206][196][194][197][206][196][197][210][146]":print:sys at,5,1
  124. 1090 print"  [211]ixteen checkers are on opposite"
  125. 1100 print" sides of the puzzle board.":print
  126. 1110 print:print"  [212]hey are arranged as shown on the"
  127. 1111 print"following sample screen:":fortm=1to1000
  128. 1112 ifpeek(198)<>0thentm=1000
  129. 1114 nexttm
  130. 1120 poke53281,10:print"[147]":goto150
  131. 1130 sys at,1,13:print"[205][201][206][196][194][197][206][196][197][210][146]":print
  132. 1140 print" [201]t is your job to reverse the positions"
  133. 1142 print"[145]of the checkers.":print
  134. 1150 print" [205]ove the black checkers only down and"
  135. 1160 print"to the right.":print
  136. 1170 print" [205]ove the white checkers only up and ":print"to the left.":print
  137. 1180 print" [217]ou may move to an adjacent empty"
  138. 1182 print"space or jump over an opposite checker.":print
  139. 1184 print" [196]iagonal moves are not allowed.":print
  140. 1190 print" [208]ress '[198]1' for auto-solve; '[198]7' to end":print
  141. 1200 print"<[212]his puzzle can be solved in 46 moves.>"
  142. 1210 sys at,24,10:print"[208]ress [210][197][212][213][210][206][146] to begin";:poke198,.
  143. 1220 get rt$:if rt$<>chr$(13) then1220
  144. 1230 as=0:poke53281,10:print"[147]":goto150
  145. 2000 :
  146. 2010 sys at,24,5:print"are you sure you want to quit?"
  147. 2020 poke198,0:wait198,1:getag$
  148. 2030 ifag$<>"y"andag$<>"[217]"andag$<>"n"andag$<>"[206]"then2020
  149. 2040 ifag$="[217]"orag$="y"then3000
  150. 2050 sys at,24,5:print"                               "
  151. 2055 sys at,24,14:print"[144][f7 quits]"
  152. 2060 return
  153. 2070 :
  154. 3000 :
  155. 3010 print"[147]":sys at,10,2:print"would you like to play again (y/n)?"
  156. 3020 poke198,0:wait198,1:getag$
  157. 3030 ifag$<>"y"andag$<>"[217]"andag$<>"n"andag$<>"[206]"then2020
  158. 3040 ifag$="[206]"orag$="n"then4000
  159. 3050 run
  160. 3060 :
  161. 4000 :
  162. 4010 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  163. 4020 ifer<>63thenprint"[147]":end
  164. 4030 load"hello connect",8
  165. 4040 end
  166. 4050 print"[147]"chr$(142)
  167. 4060 print"                             "
  168. 4070 print"           loadstar presents [144] "
  169. 4080 print"                             [144] "
  170. 4090 print"                              "
  171. 4100 print
  172. 4120 print
  173. 4130 print
  174. 4140 print"                                  "
  175. 4150 print"              mindbender          [144] "
  176. 4160 print"                                  [144] "
  177. 4170 print"       written by daniel miller   [144] "
  178. 4180 print"                                  [144] "
  179. 4190 print"                                   "
  180. 4200 print
  181. 4210 print"               (c) 1987"
  182. 4220 print
  183. 4230 print"     loadstar is not public domain"
  184. 4240 print"  please respect the author's rights."
  185. 4250 print
  186. 4260 print"           [129]                 "
  187. 4270 print"             press any key  [144] "
  188. 4280 print"           [129]                 [144] "
  189. 4290 print"                             ";
  190. 4300 print"";
  191. 4310 return
  192.