home *** CD-ROM | disk | FTP | other *** search
/ 64'er Special 17 / 64er_Magazin_Sonderheft_17_19xx_Markt__Technik_de_Side_A.d64 / knobel (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  5KB  |  233 lines

  1. 1000 gosub1940
  2. 1005 ifa=0thena=1:load"knobel mc",8,1
  3. 1009 s$=""
  4. 1010 n$="abcdefghij"
  5. 1020 s(0)=17:s(1)=55:s(2)=60:s(3)=65
  6. 1030 s(4)=97:s(5)=177
  7. 1040 dim zi$(8),op$(5),gl$(5)
  8. 1050 goto 2310:   hauptroutine
  9. 1060 '
  10. 1070 ' zi$(8) die eingegebenen 4 stel-
  11. 1080 '        ligen zahlen
  12. 1090 ' op$(5) die eingegebenen
  13. 1100 '        operatoren
  14. 1110 ' gl$(5) umgeformte gleichungen
  15. 1120 '        zu + und * gleichungen
  16. 1130 '       formten gleichung
  17. 1140 **********************************
  18. 1150 '
  19. 1160 '   die zahlen- und operations-
  20. 1170 '   variable loeschen
  21. 1180 '
  22. 1190 fort=0to5:op$(t)=" ":next
  23. 1200 fort=0to8:zi$(t)="    ":next
  24. 1210 return
  25. 1220 '
  26. 1230 '  eingaberoutine fuer eine zahl
  27. 1240 '
  28. 1250 n=0:l=0
  29. 1260 h=13+int(n/3)*65+n*5
  30. 1270 prints$tab(h+l)""mid$(zi$(n),l+1,1)"[146]"right$(zi$(n),3-l)
  31. 1280 geta$:ifa$=""then1280
  32. 1290 if(a$>="a" and a$<="j")ora$=" "then1320
  33. 1295 ifa$="[157]"andl>0thenl=l-1:goto1260
  34. 1296 ifa$="[157]"andl=0andn>0thenn=n-1:l=3:prints$tab(h)zi$(n+1)
  35. 1297 ifa$=""then1330
  36. 1300 goto1260
  37. 1320 zi$(n)=left$(zi$(n),l)+a$+right$(zi$(n),3-l)
  38. 1330 prints$tab(h)zi$(n)
  39. 1340 l=l+1:ifl=4thenn=n+1:l=0:ifn>8thenreturn
  40. 1350 goto1260
  41. 1360 '
  42. 1370 ' eingaberoutine fuer 9 zahlen
  43. 1380 '
  44. 1390 n=0
  45. 1400 h$(0)=mid$(zi$(n),1,1)
  46. 1410 h$(1)=mid$(zi$(n),2,1)
  47. 1420 h$(2)=mid$(zi$(n),3,1)
  48. 1430 h$(3)=mid$(zi$(n),4,1)
  49. 1440 gosub1250
  50. 1450 print"               ok (j,n) ?"
  51. 1460 geta$:ifa$=""then1460
  52. 1470 print"[145]                          [145][145][145]"
  53. 1480 ifa$="n"then1390
  54. 1490 ifa$<>"j"then1450
  55. 1500 return
  56. 1510 '
  57. 1520 ' eingaberoutine fuer operatoren
  58. 1530 '
  59. 1540 forn=0to5
  60. 1550 prints$tab(s(n))""op$(n)"[146]"
  61. 1560 op$(n)=""
  62. 1570 geta$:ifa$=""then1570
  63. 1580 ifa$<>"+"anda$<>"-"anda$<>"*"anda$<>"/"then1570
  64. 1590 op$(n)=a$:prints$tab(s(n))a$:next
  65. 1600 print"               ok (j,n) ?"
  66. 1610 geta$:ifa$=""then1610
  67. 1620 print"[145]                          [145][145][145]"
  68. 1630 ifa$="n"then1540
  69. 1640 ifa$<>"j"then1600
  70. 1650 return
  71. 1660 '
  72. 1670 '  gleichung zu + oder * gleichung
  73. 1680 '  umformen
  74. 1690 '
  75. 1700 a$=zi$(0):b$=zi$(1):c$=zi$(2)
  76. 1710 o$=op$(0):gosub1860:gl$(0)=d$
  77. 1720 a$=zi$(3):b$=zi$(4):c$=zi$(5)
  78. 1730 o$=op$(4):gosub1860:gl$(1)=d$
  79. 1740 a$=zi$(6):b$=zi$(7):c$=zi$(8)
  80. 1750 o$=op$(5):gosub1860:gl$(2)=d$
  81. 1760 a$=zi$(0):b$=zi$(3):c$=zi$(6)
  82. 1770 o$=op$(1):gosub1860:gl$(3)=d$
  83. 1780 a$=zi$(1):b$=zi$(4):c$=zi$(7)
  84. 1790 o$=op$(2):gosub1860:gl$(4)=d$
  85. 1800 a$=zi$(2):b$=zi$(5):c$=zi$(8)
  86. 1810 o$=op$(3):gosub1860:gl$(5)=d$
  87. 1820 return
  88. 1830 '
  89. 1840 '         umform routine
  90. 1850 '
  91. 1860 ifo$="+"thend$="+"+a$+b$+c$
  92. 1870 ifo$="-"thend$="+"+c$+b$+a$
  93. 1880 ifo$="*"thend$="*"+a$+b$+c$
  94. 1890 ifo$="/"thend$="*"+c$+b$+a$
  95. 1900 return
  96. 1910 '
  97. 1920 ' bildschirmmaske ausdrucken
  98. 1930 '
  99. 1940 print"[147]":poke53248+32,0:poke53248+33,0
  100. 1950 print"erlaubte symbole sind buchstaben
  101. 1960 [153]
  102. 1970 [153]":      a,b,c,d,e,f,g,h,i,j"
  103. 1980 [153]
  104. 1990 [153]"und rechenoperationen
  105. 2000 print
  106. 2010 print":      +,-,x,/
  107. 2020 [153]
  108. 2030 [153]"die zahlen sind maximal 4 stellig
  109. 2040 print
  110. 2050 print"---------------------------------------"
  111. 2060 print:print
  112. 2070 print"
  113. 2080 [153]"            or--------------^
  114. 2090 print"            [221]         =    [221]
  115. 2100 [153]"            (NULL)              (NULL)
  116. 2110 print"            [221]         =    [221]
  117. 2120 [153]"            (NULL)--------------(NULL)
  118. 2130 print"            [221]         =    [221]
  119. 2140 [153]"            /--------------exp
  120. 2150 print"
  121. 2160 [153]"
  122. 2170 return
  123. 2180 '
  124. 2190 'eingegebene gleichungen unloesbar
  125. 2200 '
  126. 2210 print"unloesbar !!!!"
  127. 2220 print"[146]weiter mit taste"
  128. 2230 geta$:ifa$=""then2230
  129. 2240 run
  130. 2250 ''''''''''''''''''''''''''''''''''
  131. 2260 '                                '
  132. 2270 '  h a u p t  -  r o u t i n e   '
  133. 2280 '                                '
  134. 2290 ''''''''''''''''''''''''''''''''''
  135. 2300 '
  136. 2310 gosub 1940:rem  bild-maske
  137. 2320 gosub 1190:rem
  138. 2330 gosub 1390:rem eingabe
  139. 2340 gosub 1540:rem
  140. 2350 gosub 1700:rem gleich. umformen
  141. 2355 gosub 2605:rem gleich. sortieren
  142. 2356 gosub 2700:rem 0 und 9 rausfinden
  143. 2360 fort=0to5
  144. 2365 poke52320+t,255
  145. 2370 ifmid$(gl$(t),1,1)="+"thenpoke52320+t,0
  146. 2375 next
  147. 2380 fort=0to5
  148. 2385 forx=2to13
  149. 2390 p=asc(mid$(gl$(t),x,1))-65
  150. 2395 ifp<0thenp=10
  151. 2399 poke52222+t*16+x,p:nextx,t
  152. 2400 p=0:ifw0$<>""thenp=p+1
  153. 2401 ifw9$<>""thenp=p+1
  154. 2402 poke829,p
  155. 2403 gosub 3005:rem aneup vorbereiten
  156. 2404 print"              bitte warten"
  157. 2405 sys 12*4096:rem ******************
  158. 2406 if peek(828)=0 then 2550
  159. 2410 fort=0to8:e$=""
  160. 2415 forx=1to4
  161. 2420 b$=mid$(zi$(t),x,1)
  162. 2425 ifb$=" "thene$=e$+b$:goto 2450
  163. 2430 p=asc(b$)-65
  164. 2435 p=peek(52464+p)
  165. 2440 e$=e$+chr$(peek(52448+p)+48)
  166. 2450 nextx
  167. 2455 er$(t)=e$:nextt
  168. 2500 forn=0to8
  169. 2510 h=13+int(n/3)*65+n*5
  170. 2520 prints$tab(h)er$(n)
  171. 2530 nextn
  172. 2535 print"                fertig !               "
  173. 2540 geta$:ifa$=""then2540
  174. 2545 run
  175. 2550 print"[145]tja...das ist mir doch etwas zu schwer."
  176. 2560 geta$:ifa$=""then2560
  177. 2565 run
  178. 2600 '
  179. 2601 ' gleichungen sortieren
  180. 2602 '
  181. 2605 e=0:fort=0to5
  182. 2610 ifmid$(gl$(t),1,1)="+"theng$(e)=gl$(t):e=e+1
  183. 2615 next:pl=e
  184. 2616 fort=0to5
  185. 2617 ifmid$(gl$(t),1,1)="*"theng$(e)=gl$(t):e=e+1
  186. 2618 next
  187. 2620 fort=0to5:gl$(t)=g$(t):next
  188. 2630 return
  189. 2690 '
  190. 2695 ' 0 herausfinden
  191. 2696 '
  192. 2700 w0$="":w9$=""
  193. 2701 fort=0topl-1:rem anzahl der + gl.
  194. 2705 a$=mid$(gl$(t),5,1):ifa$=" "then2750
  195. 2710 b$=mid$(gl$(t),9,1):ifb$=" "then2750
  196. 2715 c$=mid$(gl$(t),13,1):ifc$=" "then2750
  197. 2720 ifa$=c$anda$=b$thenw0$=a$:goto2750
  198. 2730 ifa$=c$thenw0$=b$
  199. 2740 ifb$=c$thenw0$=a$
  200. 2750 next
  201. 2770 goto 2800
  202. 2771 '
  203. 2772 ' 9 herausfinden
  204. 2773 '
  205. 2800 rem  ifw0$=""thenreturn
  206. 2801 fort=0topl-1:rem anzahl der + gl.
  207. 2802 fors=1to3
  208. 2805 a$=mid$(gl$(t),6-s,1):ifa$=" "then2850
  209. 2810 b$=mid$(gl$(t),10+s,1):ifb$=" "then2850
  210. 2815 c$=mid$(gl$(t),14-s,1):ifc$=" "then2850
  211. 2820 ifa$=c$anda$=b$anda$<>w0$thenw9$=a$:goto2850
  212. 2830 ifa$=c$andb$<>w0$thenw9$=b$
  213. 2840 ifb$=c$anda$<>w0$thenw9$=a$
  214. 2850 nexts,t
  215. 2870 return
  216. 3000 '
  217. 3001 ' aneup vorbereiten
  218. 3002 '
  219. 3005 rem
  220. 3100 a$=n$:fort=1to10
  221. 3110 ifmid$(a$,t,1)=w9$thena$=w9$+left$(a$,t-1)+right$(a$,10-t)
  222. 3120 next
  223. 3130 fort=1to10
  224. 3140 ifmid$(a$,t,1)=w0$thena$=w0$+left$(a$,t-1)+right$(a$,10-t)
  225. 3150 next
  226. 3160 fort=0to9
  227. 3170 poke52464+asc(mid$(a$,t+1,1))-65,t
  228. 3180 nextt
  229. 3185 poke52352,0
  230. 3190 fort=9to1step-1
  231. 3200 poke52352+10-t,t:next
  232. 3205 return
  233.