home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disc 33 / Commodore_Disc_33_19xx_-_de.d64 / zahlenraetsel (.txt) < prev   
Commodore BASIC  |  2022-10-26  |  7KB  |  358 lines

  1. 10 rem *************************
  2. 20 rem zahlen-raetsel        ***
  3. 30 rem                       ***
  4. 40 rem ein programm fuer c64 ***
  5. 50 rem                       ***
  6. 60 rem geschrieben von       ***
  7. 70 rem                       ***
  8. 80 rem guenter kramer        ***
  9. 90 rem *************************
  10. 100 gosub2700
  11. 110 gosub3240
  12. 120 ife$="0"then260
  13. 130 gosub300
  14. 140 gosub1190
  15. 150 gosub1820
  16. 160 gosub2920
  17. 170 pokeze,23:pokesp,0:syscu
  18. 180 printchr$(30)"neue aufgabe?[160](j/n)"
  19. 190 poke198,0
  20. 200 geta$:ifa$="n"then260
  21. 210 ifa$<>"j"then200
  22. 220 pokeze,23:pokesp,0:syscu
  23. 230 printchr$(158);
  24. 240 print"bitte etwas geduld!"
  25. 250 goto130
  26. 260 end
  27. 270 rem ***********************
  28. 280 rem *** aufgabe stellen ***
  29. 290 rem ***********************
  30. 300 w$(0)="*":w$(5)=":":ti$="000000"
  31. 310 w(0)=int(700*rnd(0))+111
  32. 320 a=w(0)
  33. 330 ifa=5*int(a/5)then310
  34. 340 if(aand1)=0then400
  35. 350 fori=3to17step4
  36. 360 ifi*int(a/i)=athena=99
  37. 370 ifi=11theni=9
  38. 380 next
  39. 390 ifa<>99then310
  40. 400 a=1000*(3+int(7*rnd(0)))
  41. 410 w(2)=w(0):w(1)=1
  42. 420 w(2)=w(2)+w(0):w(1)=w(1)+1
  43. 430 ifw(1)<(int(9*rnd(0))+12)then420
  44. 440 ifw(2)<1000then420
  45. 450 ifa>w(2)then420
  46. 460 ifw(2)<10000then490
  47. 470 w(2)=w(2)-w(0):w(1)=w(1)-1
  48. 480 goto460
  49. 490 a=w(0):w(5)=a:w(8)=w(1)
  50. 500 fori=17to3step-4
  51. 510 ifi*int(a/i)<>athen540
  52. 520 w(5)=a/i:w(8)=w(1)*i
  53. 530 a0=i:i=4
  54. 540 ifi=13theni=15
  55. 550 next
  56. 560 if(aand1)=1then590
  57. 570 ifi=0then590
  58. 580 w(5)=w(5)/2:w(8)=w(8)*2
  59. 590 gosub1070
  60. 600 w(3)=int(rnd(0)*600)
  61. 610 w$(3)="+":w(6)=w(0)+w(3)
  62. 620 goto650
  63. 630 w$(3)="-":w(6)=w(0)-w(3)
  64. 640 ifw(6)<1then610
  65. 650 a$=left$(ti$,2)+"."+mid$(ti$,3,2)
  66. 660 a$=a$+"."+right$(ti$,2)
  67. 670 printchr$(19)a$
  68. 680 ifw(5)=w(3)then730
  69. 690 ifw(8)=w(6)then730
  70. 700 ifw(3)=w(1)then730
  71. 710 ifw(3)=w(0)then730
  72. 720 goto740
  73. 730 w(3)=w(3)+1:goto610
  74. 740 ifw(3)>w(5)then770
  75. 750 w$(1)="+":w(4)=w(5)-w(3)
  76. 760 goto780
  77. 770 w$(1)="-":w(4)=w(3)-w(5)
  78. 780 ifw(6)>w(8)then810
  79. 790 w$(2)="+":w(7)=w(8)-w(6)
  80. 800 goto830
  81. 810 w$(2)="-":w(7)=w(6)-w(8)
  82. 820 ifw(7)<1then600
  83. 830 ifw(1)<w(7)then880
  84. 840 a=w(1)-w(4)
  85. 850 w$(4)="-"
  86. 860 ifa<>w(7)then910
  87. 870 goto1030
  88. 880 a=w(1)+w(4)
  89. 890 w$(4)="+"
  90. 900 ifa=w(7)then1030
  91. 910 a0=w(7)-a
  92. 920 if(a0and1)=1then310
  93. 930 if(aa+2=a0)and(a0<0)thenw(3)=w(3)+abs(a0/2)-1
  94. 940 if(aa-2=a0)and(a0>0)thenw(3)=w(3)+abs(a0/2)-1
  95. 950 ifaa=a0then310
  96. 960 if(aa+2=a0)and(a0>0)then310
  97. 970 if(aa-2=a0)and(a0<0)then310
  98. 980 ifac=aa+a0then310
  99. 990 ac=aa+a0
  100. 1000 aa=a0:w(3)=w(3)+1
  101. 1010 ifa0<0then610
  102. 1020 goto630
  103. 1030 return
  104. 1040 rem *****************
  105. 1050 rem *** variieren ***
  106. 1060 rem *****************
  107. 1070 a0=int(4*rnd(0))
  108. 1080 ifa0=1then1150
  109. 1090 ifa0=2then1130
  110. 1100 a=w(0):w(0)=w(8):w(8)=a
  111. 1110 a=w(5):w(5)=w(1):w(1)=a
  112. 1120 ifa0=3then1150
  113. 1130 a=w(0):w(0)=w(1):w(1)=a
  114. 1140 a=w(5):w(5)=w(8):w(8)=a
  115. 1150 return
  116. 1160 rem **********************
  117. 1170 rem *** verschluesseln ***
  118. 1180 rem **********************
  119. 1190 fori=0to9
  120. 1200 a=int(rnd(0)*10)
  121. 1210 a$=s$(i):s$(i)=s$(a)
  122. 1220 s$(a)=a$
  123. 1230 next
  124. 1240 a(0)=0:a(1)=0:a(2)=0
  125. 1250 fori=0to8
  126. 1260 a$=str$(w(i))
  127. 1270 l$(i)=""
  128. 1280 forj=2tolen(a$)
  129. 1290 a0$=s$(asc(mid$(a$,j,1))-48)
  130. 1300 l$(i)=l$(i)+a0$
  131. 1310 next
  132. 1320 a0=len(l$(i))
  133. 1330 a=i-int(i/3)*3
  134. 1340 ifa(a)<a0thena(a)=a0
  135. 1350 next
  136. 1360 printchr$(147)chr$(158)
  137. 1370 au=au+1
  138. 1380 printspc(15)"aufgabe"au
  139. 1390 gosub3030
  140. 1400 pokeze,14:pokesp,13:syscu
  141. 1410 ife$="2"thenprintchr$(30)"f1 = ende":return
  142. 1420 printchr$(30)"f1 = loesung"
  143. 1430 printspc(13)"f3 = druck aufgabe"
  144. 1440 printspc(13)"f5 = druck loesung"
  145. 1450 printspc(13)"f7 = druck beide"
  146. 1460 return
  147. 1470 rem ***************
  148. 1480 rem *** drucken ***
  149. 1490 rem ***************
  150. 1500 open1,4
  151. 1510 print#1,"aufgabe"au:print#1
  152. 1520 fori=0to2:w=i*3
  153. 1530 a$="":ifei=135then1600
  154. 1540 a$=str$(w(w))
  155. 1550 a$=right$("  "+a$,4)+"[160]"+w$(i)
  156. 1560 a0$=str$(w(w+1))
  157. 1570 a$=a$+right$("  "+a0$,4)+"[160]= "
  158. 1580 a0$=str$(w(w+2))
  159. 1590 a$=a$+right$("  "+a0$,5)+"   "
  160. 1600 ifei=134then1640
  161. 1610 a$=a$+right$("  "+l$(w),4)+" "
  162. 1620 a$=a$+w$(i)+right$("  "+l$(w+1),4)
  163. 1630 a$=a$+" =  "+right$("  "+l$(w+2),4)
  164. 1640 print#1,a$
  165. 1650 ifi>0then1690
  166. 1660 a$="   "+w$(3)+"     "+w$(4)
  167. 1670 a$=a$+"       "+w$(5)+"   "
  168. 1680 goto1730
  169. 1690 ifi<>1then1760
  170. 1700 a$=""
  171. 1710 forj=1to18:a$=a$+chr$(99):next
  172. 1720 a$=a$+"   "
  173. 1730 ifei<>136then1750
  174. 1740 a$=a$+a$
  175. 1750 print#1,a$
  176. 1760 next
  177. 1770 print#1:print#1:close1
  178. 1780 return
  179. 1790 rem **********************
  180. 1800 rem *** aufgabe loesen ***
  181. 1810 rem **********************
  182. 1820 ad=f+a+120
  183. 1830 aa=0:ab=1:gosub1970
  184. 1840 poke198,0
  185. 1850 pokee,5
  186. 1860 gosub2240
  187. 1870 if(ei>133)and(ei<137)thengosub1500
  188. 1880 ifei=133then1930
  189. 1890 pokee,7
  190. 1900 gosub2240
  191. 1910 if(ei>133)and(ei<137)thengosub1500
  192. 1920 ifei<>133then1850
  193. 1930 return
  194. 1940 rem **************************
  195. 1950 rem *** adresse fuer farbe ***
  196. 1960 rem **************************
  197. 1970 a0=int(aa/3)
  198. 1980 a1=aa-3*a0
  199. 1990 e=ad+ab+80*a0-3
  200. 2000 fori=0toa1
  201. 2010 e=e+3+a(i)
  202. 2020 next
  203. 2030 e=e-len(l$(aa))
  204. 2040 return
  205. 2050 rem ********************
  206. 2060 rem *** setzen ziffer **
  207. 2070 rem ********************
  208. 2080 a1$=mid$(l$(aa),ab,1)
  209. 2090 fori=0to8
  210. 2100 a2$=""
  211. 2110 forj=1tolen(l$(i))
  212. 2120 a0$=mid$(l$(i),j,1)
  213. 2130 ifa0$=a1$then2150
  214. 2140 a2$=a2$+a0$:goto2160
  215. 2150 a2$=a2$+a$
  216. 2160 next
  217. 2170 l$(i)=a2$
  218. 2180 next
  219. 2190 gosub1360
  220. 2200 return
  221. 2210 rem ***************
  222. 2220 rem *** eingabe ***
  223. 2230 rem ***************
  224. 2240 fori=0to150:next
  225. 2250 ei=0:pokee,7
  226. 2260 geta$:ifa$=""then2340
  227. 2270 ei=asc(a$)
  228. 2280 ifei=133then2330
  229. 2290 ifei=29thengosub2380
  230. 2300 ifei=157thengosub2470
  231. 2310 ifei=145thengosub2560
  232. 2320 ifei=17thengosub2630
  233. 2330 if(ei>47)and(ei<58)thengosub2080
  234. 2340 return
  235. 2350 rem *********************
  236. 2360 rem *** cursor rechts ***
  237. 2370 rem *********************
  238. 2380 ab=ab+1
  239. 2390 ifab<=len(l$(aa))then2420
  240. 2400 aa=aa+1:ifaa=9thenaa=0
  241. 2410 ab=1
  242. 2420 gosub1970
  243. 2430 return
  244. 2440 rem ********************
  245. 2450 rem *** cursor links ***
  246. 2460 rem ********************
  247. 2470 ab=ab-1
  248. 2480 ifab>0then2510
  249. 2490 aa=aa-1:ifaa<0thenaa=8
  250. 2500 ab=len(l$(aa))
  251. 2510 gosub1970
  252. 2520 return
  253. 2530 rem ******************
  254. 2540 rem *** cursor auf ***
  255. 2550 rem ******************
  256. 2560 aa=aa-3
  257. 2570 ifaa<0thenaa=aa+9
  258. 2580 ab=1:gosub1970
  259. 2590 return
  260. 2600 rem *****************
  261. 2610 rem *** cursor ab ***
  262. 2620 rem *****************
  263. 2630 aa=aa+3
  264. 2640 ifaa>8thenaa=aa-9
  265. 2650 ab=1:gosub1970
  266. 2660 return
  267. 2670 rem ********************
  268. 2680 rem *** anfangswerte ***
  269. 2690 rem ********************
  270. 2700 poke53280,0:poke53281,0
  271. 2710 a=rnd(-ti):   rem zufall
  272. 2720 dimw(8):      rem zahlenwerte
  273. 2730 dimw$(5):     rem rechenart
  274. 2740 diml$(8):     rem code
  275. 2750 dims$(9):     rem code-tabelle
  276. 2760 dima(2):      rem feldlaenge
  277. 2770 ze=214:       rem zeile
  278. 2780 sp=211:       rem spalte
  279. 2790 cu=58640:     rem cursor setzen
  280. 2800 f=55296:      rem farbram
  281. 2810 b=1024:       rem bildram
  282. 2820 fori=0to9:    rem code laden
  283. 2830 reada
  284. 2840 s$(i)=chr$(a)
  285. 2850 next
  286. 2860 data64,97,98,109,110
  287. 2870 data113,115,119,120,122
  288. 2880 return
  289. 2890 rem ***************
  290. 2900 rem *** loesung ***
  291. 2910 rem ***************
  292. 2920 fori=14to17:poke781,i
  293. 2930 sys59903:next
  294. 2940 pokeze,12:pokesp,15:syscu
  295. 2950 printchr$(156)"l o e s u n g"
  296. 2960 a(0)=0:a(1)=0:a(2)=0:fori=0to8
  297. 2970 fori=0to8
  298. 2980 a$=str$(w(i)):a0=len(a$)-1
  299. 2990 l$(i)=right$(a$,a0)
  300. 3000 a=i-int(i/3)*3
  301. 3010 ifa(a)<a0thena(a)=a0
  302. 3020 next
  303. 3030 a=20-int(a(0)+a(1)+a(2)+6)/2
  304. 3040 print
  305. 3050 fori=0to6step3
  306. 3060 printspc(a+4-len(l$(i)))l$(i);
  307. 3070 printspc(1)w$(i/3);
  308. 3080 printspc(1+a(1)-len(l$(i+1)))l$(i+1);
  309. 3090 printspc(1)"=";
  310. 3100 printspc(1+a(2)-len(l$(i+2)))l$(i+2)
  311. 3110 ifi>0then3150
  312. 3120 printspc(a+a(0)-1)w$(3)spc(2+a(1));
  313. 3130 printw$(4)spc(2+a(2))w$(5)
  314. 3140 goto3190
  315. 3150 ifi=6then3190
  316. 3160 a$="":forj=0to2*(20-a)
  317. 3170 a$=a$+chr$(96):next
  318. 3180 printspc(a)a$
  319. 3190 next
  320. 3200 return
  321. 3210 rem *******************
  322. 3220 rem *** erstabfrage ***
  323. 3230 rem *******************
  324. 3240 printchr$(30)chr$(147)
  325. 3250 printspc(14)"zahlen-raetsel"
  326. 3260 print
  327. 3270 printspc(13)"ein programm von"
  328. 3280 print
  329. 3290 printspc(17)"g kramer"
  330. 3300 printchr$(156):print
  331. 3310 printspc(13)"bitte eingeben :"
  332. 3320 print:print
  333. 3330 printspc(13)"1 = raetsel-loesen"
  334. 3340 printspc(13)"2 = nur drucken"
  335. 3350 print:printspc(13)"0 = ende"
  336. 3360 poke198,0
  337. 3370 gete$:ife$="0"then3570
  338. 3380 ife$="1"then3570
  339. 3390 ife$<>"2"then3370
  340. 3400 printchr$(158)chr$(147)
  341. 3410 printspc(14)"druckroutine"
  342. 3420 print:print
  343. 3430 printspc(14)"f3 = druck aufgaben"
  344. 3440 printspc(14)"f5 = druck loesungen"
  345. 3450 printspc(14)"f7 = druck beide"
  346. 3460 print:printchr$(30)
  347. 3470 printspc(14)"f1 = ende drucken"
  348. 3480 poke198,0
  349. 3490 geta$:ifa$=""then3490
  350. 3500 ei=asc(a$)
  351. 3510 if(ei<133)or(ei>136)then3490
  352. 3520 ifei=133then3240
  353. 3530 geta$:ifa$=chr$(133)then3240
  354. 3540 gosub300:gosub1190
  355. 3550 gosub1500
  356. 3560 goto3530
  357. 3570 return
  358.