Advertisement
verz

SuBloku.Bas

Dec 6th, 2019
3,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XBasic 16.21 KB | None | 0 0
  1. 10 dim su(9,9),sh(9,9)
  2. 30 dim gx(9,9),gy(9,9)
  3. 40 dim n(9,9,9)
  4. 50 for i=1 to 12:h$=h$+chr$(17):next i:h$=chr$(19)+h$
  5. 55 k$=chr$(19)+chr$(18)+chr$(154)
  6.  
  7. rem *** colori per lo schema
  8. 60 poke 53281,0
  9. 65 c(1)=155:c(2)=154:c(3)=28:c(4)=158:c(5)=5
  10. 70 c(6)=159:c(7)=156:c(8)=30:c(9)=150
  11. 80 for i=1 to 9
  12. 90 r$(i)=r$(i-1)+chr$(29):d$(i)=d$(i-1)+chr$(17)
  13. 95 next i
  14.  
  15. 100 gosub 25000
  16. 110 print chr$(147)
  17. 120 for i=1 to 9:gx(i,0)=0:next i
  18.  
  19. 150 for i=1 to 9
  20. 160   for j=1 to 9
  21. 170     x=sh(i,j)
  22. 180     gx(x,0)=gx(x,0)+1
  23. 190     gx(x,gx(x,0))=i:gy(x,gx(x,0))=j
  24. 200   next j
  25. 210 next i
  26.  
  27.  
  28. 420 gosub 19800
  29.  
  30. rem *** tutte le note per tutte le caselle, tranne quelle piene
  31. 1000 for k=1 to 9:n(0,0,k)=9:next k
  32. 1010 for i=1 to 9
  33. 1020   for j=1 to 9
  34. 1030     u=1:n(i,j,0)=9:v=su(i,j)
  35. 1040     if v>0 then u=0
  36. 1050     for k=1 to 9:n(i,j,k)=u:next k
  37. 1060   next j:next i
  38. 1070 cf=0
  39.  
  40. rem *** rimozione note per valori gia' in riga/colonna
  41. 1090 for i=1 to 9
  42. 1100   for j=1 to 9
  43. 1110     if su(i,j)>0 then gosub 11000
  44. 1115     rem print k$;"rimuovo note per valori iniziali";i;j;"    "
  45. 1120   next j
  46. 1130 next i
  47.  
  48. rem *** loop di elaborazione
  49. 1200 fl=0
  50. 1210 gosub 10000
  51. 1220 gosub 13000
  52. 1230 gosub 19800
  53. 1235 if fl=1 then gosub 19700
  54. 1240 if fl=1 then 1200
  55. 1250 fl=1:gosub 19700:if fl=0 then 9000
  56. 1260 fl=0:gosub 14000:if fl=1 then 1200
  57.  
  58. rem *** fine elaborazione
  59. 9000 print:print int((ti-t)/60) "sec"
  60. 9010 print
  61. 9015 print:print "   premi un tasto..."
  62. 9020 get l$:if l$="" then 9020
  63. 9999 goto 100
  64.  
  65.  
  66. rem *** cerca caselle con singole note
  67. 10000 for i=1 to 9
  68. 10010   for j=1 to 9
  69. 10015     rem print k$;"cerco celle con singole note ";i;j;"    "
  70. 10020     if n(i,j,0)=0 then 10100
  71. 10030     l=0
  72. 10040     for k=1 to 9:if n(i,j,k) then l=l+1:p=k
  73. 10050     next k
  74. 10060     if l<>1 then 10100
  75. 10062     print chr$(19)+r$(j)+d$(i)+chr$(18)+chr$(c(sh(i,j)))+mid$(str$(p),2)
  76. 10065     print h$;p;" -> ("i;",";j;")"
  77. 10070     su(i,j)=p:n(i,j,0)=0:for k=1 to 9:n(i,j,k)=0:next k
  78. 10080     gosub 11000
  79. 10090     goto 10000
  80. 10100   next j:next i
  81. 10110 return
  82.  
  83. rem *** rimuove le note attinenti al valore di una casella
  84. 11000 a=su(i,j):n(0,0,a)=n(0,0,a)-1
  85. 11005 q=sh(i,j):cf=cf+1
  86. 11010 for m=1 to 9
  87. 11020   n(m,j,a)=0
  88. 11030   n(i,m,a)=0
  89. 11040   x=gx(q,m):y=gy(q,m)
  90. 11050   n(x,y,a)=0
  91. 11060   n(i,j,m)=0
  92. 11080 next m
  93. 11085 fl=1
  94. 11090 return
  95.  
  96. rem *** cerca le note che si ripetono una sola volta in riga/colonna/blocco
  97. 13000 fd=0
  98. 13010 for z=1 to 9
  99. 13020   rem print k$;"cerco singole note di ";z;"     "
  100. 13030   for f=1 to 9
  101. 13040     fx=0:fy=0:fb=0
  102. 13050     for g=1 to 9
  103. 13060       if n(f,g,z) then fx=fx+1:v=g
  104. 13070       if n(g,f,z) then fy=fy+1:w=g
  105. 13075       if n(gx(f,g),gy(f,g),z) then fb=fb+1:u=g
  106. 13080     next g
  107. 13090     if fx=1 then i=f:j=v:goto 13150
  108. 13100     if fy=1 then i=w:j=f:goto 13150
  109. 13105     if fb=1 then i=gx(f,u):j=gy(f,u):goto 13150
  110. 13110   next f
  111. 13120 next z
  112. 13130 if fd=1 and cf<81 goto 13000
  113. 13140 return
  114. 13150 su(i,j)=z:n(i,j,0)=0
  115. 13160 for k=1 to 9:n(i,j,k)=0:next k
  116. 13170 gosub 11000
  117. 13180 fd=1:print chr$(19)+r$(j)+d$(i)+chr$(18)+chr$(c(sh(i,j)))+mid$(str$(z),2)
  118. 13190 print h$;z;" -> ("i;",";j;")"
  119. 13200 if cf=81 then return
  120. 13210 goto 13110
  121.  
  122.  
  123.  
  124. rem *** 1av: controlla se una riga/colonna di note appartiene a un blocco
  125. 14000 for b=1 to 9
  126. 14010   for k=1 to 9
  127. 14015   rem print k$;"cerco r/c con note in un blocco";b;k;"  "
  128. 14020     cx=0:cy=0
  129. 14030     a=2^(k-1)
  130. 14040     for m=1 to 9
  131. 14050       if n(gx(b,m),gy(b,m),k) = 0 goto 14110
  132. 14060       if cx=0 then cx=gx(b,m)
  133. 14070       if cy=0 then cy=gy(b,m)
  134. 14080       if cx<>gx(b,m) then cx=-1
  135. 14090       if cy<>gy(b,m) then cy=-1
  136. 14100       if cx+cy=-2 goto 14140
  137. 14110     next m
  138. 14120     if cx>0 then gosub 14300
  139. 14130     if cy>0 then gosub 14400
  140. 14140   next k
  141. 14150 next b
  142. 14160 return
  143.  
  144. 14300 for j=1 to 9
  145. 14310   if sh(cx,j)=b then 14330
  146. 14320   if n(cx,j,k) then n(cx,j,k)=0
  147. 14330 next j
  148. 14340 fl=1:return
  149.  
  150. 14400 for i=1 to 9
  151. 14410   if sh(i,cy)=b then 14430
  152. 14420   if n(i,cy,k) then n(i,cy,k)=0
  153. 14430 next i
  154. 14440 fl=1:return
  155.  
  156. rem *** controlla se e' risolto
  157. 19700 for k=1 to 9
  158. 19710   if n(0,0,k)>0 then return
  159. 19760 next k
  160. 19770 fl=0
  161. 19780 return
  162.  
  163. rem *** stampa lo schema
  164. 19800 print chr$(147)
  165. 19810 for i=1 to 9
  166. 19815   l$=""
  167. 19820   for j=1 to 9
  168. 19825     a=su(i,j)
  169. 19830     a$=" ":if a then a$=mid$(str$(a),2)
  170. 19840     a$=chr$(18)+chr$(c(sh(i,j)))+a$
  171. 19850     l$=l$+a$
  172. 19860   next j
  173. 19865   print " "+l$;chr$(154)
  174. 19870   rem
  175. 19880 next i
  176. 19890 return
  177.  
  178.  
  179. rem *** SuBloku easy
  180. 20001 su(1,1)=9:su(1,2)=2:su(1,3)=1:su(1,4)=5:su(1,5)=6
  181. 20002 su(1,6)=0:su(1,7)=0:su(1,8)=0:su(1,9)=0
  182. 20003 su(2,1)=0:su(2,2)=0:su(2,3)=0:su(2,4)=0:su(2,5)=0
  183. 20004 su(2,6)=9:su(2,7)=6:su(2,8)=0:su(2,9)=2
  184. 20005 su(3,1)=0:su(3,2)=6:su(3,3)=0:su(3,4)=0:su(3,5)=0
  185. 20006 su(3,6)=0:su(3,7)=0:su(3,8)=2:su(3,9)=4
  186. 20007 su(4,1)=0:su(4,2)=1:su(4,3)=0:su(4,4)=0:su(4,5)=4
  187. 20008 su(4,6)=0:su(4,7)=0:su(4,8)=0:su(4,9)=9
  188. 20009 su(5,1)=0:su(5,2)=0:su(5,3)=5:su(5,4)=8:su(5,5)=0
  189. 20010 su(5,6)=1:su(5,7)=2:su(5,8)=0:su(5,9)=0
  190. 20011 su(6,1)=3:su(6,2)=0:su(6,3)=0:su(6,4)=0:su(6,5)=7
  191. 20012 su(6,6)=0:su(6,7)=0:su(6,8)=9:su(6,9)=0
  192. 20013 su(7,1)=1:su(7,2)=9:su(7,3)=0:su(7,4)=0:su(7,5)=0
  193. 20014 su(7,6)=0:su(7,7)=0:su(7,8)=4:su(7,9)=0
  194. 20015 su(8,1)=2:su(8,2)=0:su(8,3)=9:su(8,4)=6:su(8,5)=0
  195. 20016 su(8,6)=0:su(8,7)=0:su(8,8)=0:su(8,9)=0
  196. 20017 su(9,1)=0:su(9,2)=0:su(9,3)=0:su(9,4)=0:su(9,5)=2
  197. 20018 su(9,6)=3:su(9,7)=9:su(9,8)=8:su(9,9)=6
  198. 20019 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=1:sh(1,5)=1
  199. 20020 sh(1,6)=2:sh(1,7)=2:sh(1,8)=2:sh(1,9)=2
  200. 20021 sh(2,1)=1:sh(2,2)=1:sh(2,3)=1:sh(2,4)=3:sh(2,5)=3
  201. 20022 sh(2,6)=2:sh(2,7)=2:sh(2,8)=4:sh(2,9)=2
  202. 20023 sh(3,1)=1:sh(3,2)=3:sh(3,3)=3:sh(3,4)=3:sh(3,5)=2
  203. 20024 sh(3,6)=2:sh(3,7)=4:sh(3,8)=4:sh(3,9)=4
  204. 20025 sh(4,1)=5:sh(4,2)=3:sh(4,3)=3:sh(4,4)=3:sh(4,5)=3
  205. 20026 sh(4,6)=6:sh(4,7)=6:sh(4,8)=4:sh(4,9)=4
  206. 20027 sh(5,1)=5:sh(5,2)=5:sh(5,3)=6:sh(5,4)=6:sh(5,5)=6
  207. 20028 sh(5,6)=6:sh(5,7)=6:sh(5,8)=4:sh(5,9)=4
  208. 20029 sh(6,1)=5:sh(6,2)=5:sh(6,3)=6:sh(6,4)=6:sh(6,5)=7
  209. 20030 sh(6,6)=7:sh(6,7)=7:sh(6,8)=7:sh(6,9)=4
  210. 20031 sh(7,1)=5:sh(7,2)=5:sh(7,3)=5:sh(7,4)=8:sh(7,5)=8
  211. 20032 sh(7,6)=7:sh(7,7)=7:sh(7,8)=7:sh(7,9)=9
  212. 20033 sh(8,1)=8:sh(8,2)=5:sh(8,3)=8:sh(8,4)=8:sh(8,5)=7
  213. 20034 sh(8,6)=7:sh(8,7)=9:sh(8,8)=9:sh(8,9)=9
  214. 20035 sh(9,1)=8:sh(9,2)=8:sh(9,3)=8:sh(9,4)=8:sh(9,5)=9
  215. 20036 sh(9,6)=9:sh(9,7)=9:sh(9,8)=9:sh(9,9)=9
  216. 20040 return
  217.  
  218. rem *** SuBloku medio
  219. 20101 su(1,1)=0:su(1,2)=0:su(1,3)=0:su(1,4)=0:su(1,5)=2
  220. 20102 su(1,6)=0:su(1,7)=7:su(1,8)=3:su(1,9)=0
  221. 20103 su(2,1)=1:su(2,2)=0:su(2,3)=0:su(2,4)=0:su(2,5)=0
  222. 20104 su(2,6)=9:su(2,7)=5:su(2,8)=0:su(2,9)=0
  223. 20105 su(3,1)=2:su(3,2)=4:su(3,3)=0:su(3,4)=0:su(3,5)=1
  224. 20106 su(3,6)=0:su(3,7)=0:su(3,8)=0:su(3,9)=0
  225. 20107 su(4,1)=0:su(4,2)=6:su(4,3)=0:su(4,4)=4:su(4,5)=0
  226. 20108 su(4,6)=2:su(4,7)=0:su(4,8)=0:su(4,9)=0
  227. 20109 su(5,1)=9:su(5,2)=0:su(5,3)=1:su(5,4)=0:su(5,5)=0
  228. 20110 su(5,6)=0:su(5,7)=3:su(5,8)=0:su(5,9)=2
  229. 20111 su(6,1)=0:su(6,2)=0:su(6,3)=0:su(6,4)=6:su(6,5)=0
  230. 20112 su(6,6)=5:su(6,7)=0:su(6,8)=4:su(6,9)=0
  231. 20113 su(7,1)=0:su(7,2)=0:su(7,3)=0:su(7,4)=0:su(7,5)=5
  232. 20114 su(7,6)=0:su(7,7)=0:su(7,8)=7:su(7,9)=3
  233. 20115 su(8,1)=0:su(8,2)=0:su(8,3)=8:su(8,4)=3:su(8,5)=0
  234. 20116 su(8,6)=0:su(8,7)=0:su(8,8)=0:su(8,9)=5
  235. 20117 su(9,1)=0:su(9,2)=1:su(9,3)=7:su(9,4)=0:su(9,5)=3
  236. 20118 su(9,6)=0:su(9,7)=0:su(9,8)=0:su(9,9)=0
  237. 20119 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=2:sh(1,5)=2
  238. 20120 sh(1,6)=2:sh(1,7)=2:sh(1,8)=2:sh(1,9)=2
  239. 20121 sh(2,1)=3:sh(2,2)=3:sh(2,3)=1:sh(2,4)=1:sh(2,5)=1
  240. 20122 sh(2,6)=1:sh(2,7)=4:sh(2,8)=2:sh(2,9)=2
  241. 20123 sh(3,1)=3:sh(3,2)=3:sh(3,3)=3:sh(3,4)=1:sh(3,5)=1
  242. 20124 sh(3,6)=5:sh(3,7)=4:sh(3,8)=2:sh(3,9)=4
  243. 20125 sh(4,1)=3:sh(4,2)=3:sh(4,3)=3:sh(4,4)=5:sh(4,5)=5
  244. 20126 sh(4,6)=5:sh(4,7)=4:sh(4,8)=4:sh(4,9)=4
  245. 20127 sh(5,1)=6:sh(5,2)=3:sh(5,3)=6:sh(5,4)=6:sh(5,5)=5
  246. 20128 sh(5,6)=4:sh(5,7)=4:sh(5,8)=7:sh(5,9)=4
  247. 20129 sh(6,1)=6:sh(6,2)=6:sh(6,3)=6:sh(6,4)=5:sh(6,5)=5
  248. 20130 sh(6,6)=5:sh(6,7)=7:sh(6,8)=7:sh(6,9)=7
  249. 20131 sh(7,1)=6:sh(7,2)=8:sh(7,3)=6:sh(7,4)=5:sh(7,5)=9
  250. 20132 sh(7,6)=9:sh(7,7)=7:sh(7,8)=7:sh(7,9)=7
  251. 20133 sh(8,1)=8:sh(8,2)=8:sh(8,3)=6:sh(8,4)=9:sh(8,5)=9
  252. 20134 sh(8,6)=9:sh(8,7)=9:sh(8,8)=7:sh(8,9)=7
  253. 20135 sh(9,1)=8:sh(9,2)=8:sh(9,3)=8:sh(9,4)=8:sh(9,5)=8
  254. 20136 sh(9,6)=8:sh(9,7)=9:sh(9,8)=9:sh(9,9)=9
  255. 20140 return
  256.  
  257. rem *** SuBloku difficile 1
  258. 20201 su(1,1)=0:su(1,2)=0:su(1,3)=0:su(1,4)=2:su(1,5)=0
  259. 20202 su(1,6)=1:su(1,7)=7:su(1,8)=0:su(1,9)=0
  260. 20203 su(2,1)=0:su(2,2)=1:su(2,3)=4:su(2,4)=0:su(2,5)=0
  261. 20204 su(2,6)=0:su(2,7)=0:su(2,8)=0:su(2,9)=0
  262. 20205 su(3,1)=0:su(3,2)=7:su(3,3)=0:su(3,4)=0:su(3,5)=4
  263. 20206 su(3,6)=0:su(3,7)=0:su(3,8)=0:su(3,9)=1
  264. 20207 su(4,1)=3:su(4,2)=0:su(4,3)=0:su(4,4)=0:su(4,5)=2
  265. 20208 su(4,6)=0:su(4,7)=0:su(4,8)=0:su(4,9)=6
  266. 20209 su(5,1)=0:su(5,2)=0:su(5,3)=8:su(5,4)=1:su(5,5)=0
  267. 20210 su(5,6)=3:su(5,7)=5:su(5,8)=0:su(5,9)=0
  268. 20211 su(6,1)=8:su(6,2)=0:su(6,3)=0:su(6,4)=0:su(6,5)=9
  269. 20212 su(6,6)=0:su(6,7)=0:su(6,8)=0:su(6,9)=3
  270. 20213 su(7,1)=1:su(7,2)=0:su(7,3)=0:su(7,4)=0:su(7,5)=3
  271. 20214 su(7,6)=0:su(7,7)=0:su(7,8)=7:su(7,9)=0
  272. 20215 su(8,1)=0:su(8,2)=0:su(8,3)=0:su(8,4)=0:su(8,5)=0
  273. 20216 su(8,6)=0:su(8,7)=9:su(8,8)=4:su(8,9)=0
  274. 20217 su(9,1)=0:su(9,2)=0:su(9,3)=1:su(9,4)=9:su(9,5)=0
  275. 20218 su(9,6)=7:su(9,7)=0:su(9,8)=0:su(9,9)=0
  276. 20219 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=2:sh(1,5)=2
  277. 20220 sh(1,6)=2:sh(1,7)=2:sh(1,8)=2:sh(1,9)=2
  278. 20221 sh(2,1)=1:sh(2,2)=1:sh(2,3)=1:sh(2,4)=2:sh(2,5)=3
  279. 20222 sh(2,6)=3:sh(2,7)=3:sh(2,8)=3:sh(2,9)=2
  280. 20223 sh(3,1)=1:sh(3,2)=1:sh(3,3)=1:sh(3,4)=2:sh(3,5)=3
  281. 20224 sh(3,6)=3:sh(3,7)=4:sh(3,8)=3:sh(3,9)=3
  282. 20225 sh(4,1)=5:sh(4,2)=5:sh(4,3)=5:sh(4,4)=6:sh(4,5)=6
  283. 20226 sh(4,6)=4:sh(4,7)=4:sh(4,8)=3:sh(4,9)=4
  284. 20227 sh(5,1)=5:sh(5,2)=7:sh(5,3)=7:sh(5,4)=6:sh(5,5)=6
  285. 20228 sh(5,6)=6:sh(5,7)=4:sh(5,8)=4:sh(5,9)=4
  286. 20229 sh(6,1)=5:sh(6,2)=7:sh(6,3)=7:sh(6,4)=8:sh(6,5)=6
  287. 20230 sh(6,6)=6:sh(6,7)=6:sh(6,8)=9:sh(6,9)=4
  288. 20231 sh(7,1)=5:sh(7,2)=7:sh(7,3)=8:sh(7,4)=8:sh(7,5)=8
  289. 20232 sh(7,6)=6:sh(7,7)=9:sh(7,8)=9:sh(7,9)=4
  290. 20233 sh(8,1)=5:sh(8,2)=7:sh(8,3)=7:sh(8,4)=7:sh(8,5)=8
  291. 20234 sh(8,6)=9:sh(8,7)=9:sh(8,8)=9:sh(8,9)=9
  292. 20235 sh(9,1)=5:sh(9,2)=5:sh(9,3)=7:sh(9,4)=8:sh(9,5)=8
  293. 20236 sh(9,6)=8:sh(9,7)=8:sh(9,8)=9:sh(9,9)=9
  294. 20240 return
  295.  
  296. rem *** SuBloku difficile 2
  297. 20301 su(1,1)=0:su(1,2)=0:su(1,3)=0:su(1,4)=2:su(1,5)=0
  298. 20302 su(1,6)=1:su(1,7)=7:su(1,8)=0:su(1,9)=0
  299. 20303 su(2,1)=0:su(2,2)=0:su(2,3)=4:su(2,4)=0:su(2,5)=0
  300. 20304 su(2,6)=0:su(2,7)=0:su(2,8)=0:su(2,9)=0
  301. 20305 su(3,1)=0:su(3,2)=7:su(3,3)=0:su(3,4)=0:su(3,5)=4
  302. 20306 su(3,6)=0:su(3,7)=0:su(3,8)=0:su(3,9)=1
  303. 20307 su(4,1)=3:su(4,2)=0:su(4,3)=0:su(4,4)=0:su(4,5)=2
  304. 20308 su(4,6)=0:su(4,7)=0:su(4,8)=0:su(4,9)=6
  305. 20309 su(5,1)=0:su(5,2)=0:su(5,3)=8:su(5,4)=0:su(5,5)=0
  306. 20310 su(5,6)=0:su(5,7)=5:su(5,8)=0:su(5,9)=0
  307. 20311 su(6,1)=8:su(6,2)=0:su(6,3)=0:su(6,4)=0:su(6,5)=9
  308. 20312 su(6,6)=0:su(6,7)=0:su(6,8)=0:su(6,9)=3
  309. 20313 su(7,1)=1:su(7,2)=0:su(7,3)=0:su(7,4)=0:su(7,5)=3
  310. 20314 su(7,6)=0:su(7,7)=0:su(7,8)=7:su(7,9)=0
  311. 20315 su(8,1)=0:su(8,2)=0:su(8,3)=0:su(8,4)=0:su(8,5)=0
  312. 20316 su(8,6)=0:su(8,7)=0:su(8,8)=4:su(8,9)=0
  313. 20317 su(9,1)=0:su(9,2)=0:su(9,3)=1:su(9,4)=9:su(9,5)=0
  314. 20318 su(9,6)=7:su(9,7)=0:su(9,8)=0:su(9,9)=0
  315. 20319 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=2:sh(1,5)=2
  316. 20320 sh(1,6)=2:sh(1,7)=2:sh(1,8)=2:sh(1,9)=2
  317. 20321 sh(2,1)=1:sh(2,2)=1:sh(2,3)=1:sh(2,4)=2:sh(2,5)=3
  318. 20322 sh(2,6)=3:sh(2,7)=3:sh(2,8)=3:sh(2,9)=2
  319. 20323 sh(3,1)=1:sh(3,2)=1:sh(3,3)=1:sh(3,4)=2:sh(3,5)=3
  320. 20324 sh(3,6)=3:sh(3,7)=4:sh(3,8)=3:sh(3,9)=3
  321. 20325 sh(4,1)=5:sh(4,2)=5:sh(4,3)=5:sh(4,4)=6:sh(4,5)=6
  322. 20326 sh(4,6)=4:sh(4,7)=4:sh(4,8)=3:sh(4,9)=4
  323. 20327 sh(5,1)=5:sh(5,2)=7:sh(5,3)=7:sh(5,4)=6:sh(5,5)=6
  324. 20328 sh(5,6)=6:sh(5,7)=4:sh(5,8)=4:sh(5,9)=4
  325. 20329 sh(6,1)=5:sh(6,2)=7:sh(6,3)=7:sh(6,4)=8:sh(6,5)=6
  326. 20330 sh(6,6)=6:sh(6,7)=6:sh(6,8)=9:sh(6,9)=4
  327. 20331 sh(7,1)=5:sh(7,2)=7:sh(7,3)=8:sh(7,4)=8:sh(7,5)=8
  328. 20332 sh(7,6)=6:sh(7,7)=9:sh(7,8)=9:sh(7,9)=4
  329. 20333 sh(8,1)=5:sh(8,2)=7:sh(8,3)=7:sh(8,4)=7:sh(8,5)=8
  330. 20334 sh(8,6)=9:sh(8,7)=9:sh(8,8)=9:sh(8,9)=9
  331. 20335 sh(9,1)=5:sh(9,2)=5:sh(9,3)=7:sh(9,4)=8:sh(9,5)=8
  332. 20336 sh(9,6)=8:sh(9,7)=8:sh(9,8)=9:sh(9,9)=9
  333. 20340 return
  334.  
  335. rem *** sudoku easy
  336. 20401 su(1,1)=0:su(1,2)=0:su(1,3)=7:su(1,4)=0:su(1,5)=0
  337. 20402 su(1,6)=3:su(1,7)=9:su(1,8)=0:su(1,9)=2
  338. 20403 su(2,1)=0:su(2,2)=0:su(2,3)=0:su(2,4)=8:su(2,5)=0
  339. 20404 su(2,6)=0:su(2,7)=0:su(2,8)=0:su(2,9)=0
  340. 20405 su(3,1)=9:su(3,2)=4:su(3,3)=3:su(3,4)=0:su(3,5)=0
  341. 20406 su(3,6)=0:su(3,7)=0:su(3,8)=0:su(3,9)=7
  342. 20407 su(4,1)=6:su(4,2)=9:su(4,3)=0:su(4,4)=0:su(4,5)=0
  343. 20408 su(4,6)=0:su(4,7)=0:su(4,8)=0:su(4,9)=0
  344. 20409 su(5,1)=3:su(5,2)=0:su(5,3)=0:su(5,4)=5:su(5,5)=2
  345. 20410 su(5,6)=7:su(5,7)=0:su(5,8)=0:su(5,9)=0
  346. 20411 su(6,1)=0:su(6,2)=0:su(6,3)=0:su(6,4)=0:su(6,5)=0
  347. 20412 su(6,6)=0:su(6,7)=8:su(6,8)=4:su(6,9)=0
  348. 20413 su(7,1)=0:su(7,2)=0:su(7,3)=0:su(7,4)=0:su(7,5)=4
  349. 20414 su(7,6)=8:su(7,7)=0:su(7,8)=0:su(7,9)=0
  350. 20415 su(8,1)=2:su(8,2)=6:su(8,3)=0:su(8,4)=0:su(8,5)=0
  351. 20416 su(8,6)=0:su(8,7)=0:su(8,8)=0:su(8,9)=0
  352. 20417 su(9,1)=0:su(9,2)=0:su(9,3)=0:su(9,4)=0:su(9,5)=0
  353. 20418 su(9,6)=0:su(9,7)=1:su(9,8)=2:su(9,9)=9
  354. 20419 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=2:sh(1,5)=2
  355. 20420 sh(1,6)=2:sh(1,7)=3:sh(1,8)=3:sh(1,9)=3
  356. 20421 sh(2,1)=1:sh(2,2)=1:sh(2,3)=1:sh(2,4)=2:sh(2,5)=2
  357. 20422 sh(2,6)=2:sh(2,7)=3:sh(2,8)=3:sh(2,9)=3
  358. 20423 sh(3,1)=1:sh(3,2)=1:sh(3,3)=1:sh(3,4)=2:sh(3,5)=2
  359. 20424 sh(3,6)=2:sh(3,7)=3:sh(3,8)=3:sh(3,9)=3
  360. 20425 sh(4,1)=4:sh(4,2)=4:sh(4,3)=4:sh(4,4)=5:sh(4,5)=5
  361. 20426 sh(4,6)=5:sh(4,7)=6:sh(4,8)=6:sh(4,9)=6
  362. 20427 sh(5,1)=4:sh(5,2)=4:sh(5,3)=4:sh(5,4)=5:sh(5,5)=5
  363. 20428 sh(5,6)=5:sh(5,7)=6:sh(5,8)=6:sh(5,9)=6
  364. 20429 sh(6,1)=4:sh(6,2)=4:sh(6,3)=4:sh(6,4)=5:sh(6,5)=5
  365. 20430 sh(6,6)=5:sh(6,7)=6:sh(6,8)=6:sh(6,9)=6
  366. 20431 sh(7,1)=7:sh(7,2)=7:sh(7,3)=7:sh(7,4)=8:sh(7,5)=8
  367. 20432 sh(7,6)=8:sh(7,7)=9:sh(7,8)=9:sh(7,9)=9
  368. 20433 sh(8,1)=7:sh(8,2)=7:sh(8,3)=7:sh(8,4)=8:sh(8,5)=8
  369. 20434 sh(8,6)=8:sh(8,7)=9:sh(8,8)=9:sh(8,9)=9
  370. 20435 sh(9,1)=7:sh(9,2)=7:sh(9,3)=7:sh(9,4)=8:sh(9,5)=8
  371. 20436 sh(9,6)=8:sh(9,7)=9:sh(9,8)=9:sh(9,9)=9
  372. 20440 return
  373.  
  374. rem *** sudoku difficile
  375. 20501 su(1,1)=0:su(1,2)=2:su(1,3)=0:su(1,4)=0:su(1,5)=0
  376. 20502 su(1,6)=0:su(1,7)=0:su(1,8)=8:su(1,9)=6
  377. 20503 su(2,1)=8:su(2,2)=0:su(2,3)=7:su(2,4)=0:su(2,5)=0
  378. 20504 su(2,6)=5:su(2,7)=0:su(2,8)=0:su(2,9)=0
  379. 20505 su(3,1)=0:su(3,2)=0:su(3,3)=3:su(3,4)=0:su(3,5)=4
  380. 20506 su(3,6)=0:su(3,7)=0:su(3,8)=0:su(3,9)=2
  381. 20507 su(4,1)=0:su(4,2)=5:su(4,3)=0:su(4,4)=7:su(4,5)=9
  382. 20508 su(4,6)=0:su(4,7)=0:su(4,8)=0:su(4,9)=0
  383. 20509 su(5,1)=0:su(5,2)=0:su(5,3)=1:su(5,4)=0:su(5,5)=5
  384. 20510 su(5,6)=0:su(5,7)=2:su(5,8)=0:su(5,9)=0
  385. 20511 su(6,1)=0:su(6,2)=0:su(6,3)=0:su(6,4)=0:su(6,5)=2
  386. 20512 su(6,6)=6:su(6,7)=0:su(6,8)=7:su(6,9)=0
  387. 20513 su(7,1)=5:su(7,2)=0:su(7,3)=0:su(7,4)=0:su(7,5)=3
  388. 20514 su(7,6)=0:su(7,7)=1:su(7,8)=4:su(7,9)=0
  389. 20515 su(8,1)=0:su(8,2)=0:su(8,3)=0:su(8,4)=4:su(8,5)=0
  390. 20516 su(8,6)=0:su(8,7)=0:su(8,8)=0:su(8,9)=5
  391. 20517 su(9,1)=9:su(9,2)=1:su(9,3)=0:su(9,4)=0:su(9,5)=0
  392. 20518 su(9,6)=0:su(9,7)=0:su(9,8)=2:su(9,9)=0
  393. 20519 sh(1,1)=1:sh(1,2)=1:sh(1,3)=1:sh(1,4)=2:sh(1,5)=2
  394. 20520 sh(1,6)=2:sh(1,7)=3:sh(1,8)=3:sh(1,9)=3
  395. 20521 sh(2,1)=1:sh(2,2)=1:sh(2,3)=1:sh(2,4)=2:sh(2,5)=2
  396. 20522 sh(2,6)=2:sh(2,7)=3:sh(2,8)=3:sh(2,9)=3
  397. 20523 sh(3,1)=1:sh(3,2)=1:sh(3,3)=1:sh(3,4)=2:sh(3,5)=2
  398. 20524 sh(3,6)=2:sh(3,7)=3:sh(3,8)=3:sh(3,9)=3
  399. 20525 sh(4,1)=4:sh(4,2)=4:sh(4,3)=4:sh(4,4)=5:sh(4,5)=5
  400. 20526 sh(4,6)=5:sh(4,7)=6:sh(4,8)=6:sh(4,9)=6
  401. 20527 sh(5,1)=4:sh(5,2)=4:sh(5,3)=4:sh(5,4)=5:sh(5,5)=5
  402. 20528 sh(5,6)=5:sh(5,7)=6:sh(5,8)=6:sh(5,9)=6
  403. 20529 sh(6,1)=4:sh(6,2)=4:sh(6,3)=4:sh(6,4)=5:sh(6,5)=5
  404. 20530 sh(6,6)=5:sh(6,7)=6:sh(6,8)=6:sh(6,9)=6
  405. 20531 sh(7,1)=7:sh(7,2)=7:sh(7,3)=7:sh(7,4)=8:sh(7,5)=8
  406. 20532 sh(7,6)=8:sh(7,7)=9:sh(7,8)=9:sh(7,9)=9
  407. 20533 sh(8,1)=7:sh(8,2)=7:sh(8,3)=7:sh(8,4)=8:sh(8,5)=8
  408. 20534 sh(8,6)=8:sh(8,7)=9:sh(8,8)=9:sh(8,9)=9
  409. 20535 sh(9,1)=7:sh(9,2)=7:sh(9,3)=7:sh(9,4)=8:sh(9,5)=8
  410. 20536 sh(9,6)=8:sh(9,7)=9:sh(9,8)=9:sh(9,9)=9
  411. 20540 return
  412.  
  413. 25000 print chr$(147)
  414. 25010 print:print:print
  415. 25020 print "   1. subloku facile"
  416. 25030 print "   2. subloku medio"
  417. 25040 print "   3. subloku difficile 1"
  418. 25050 print "   4. subloku difficile 2"
  419. 25060 print "   5. sudoku facile"
  420. 25070 print "   6. sudoku difficile"
  421. 25080 print
  422. 25090 print "   7. esci"
  423. 25100 print:print "  scegli 1-7"
  424. 25110 get l$:if l$="" then 25110
  425. 25120 if l$<"1" or l$>"7" then 25110
  426. 25130 if l$="7" then end
  427. 25140 t=ti
  428. 25150 on val(l$) goto 20001,20101,20201,20301,20401,20501
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement