home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1992 August / 64er_Magazin_92-08_1992_Markt__Technik_de_Side_A.d64 / maqu (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  669b  |  21 lines

  1. 1 poke53281,0:poke53280,0:print"[147][158]   * * *   magisches  quadrat   * * *"
  2. 2 print"             von d. rudolph"
  3. 3 print:print:poke19,1:input"   seitenlaenge   > ";l$:poke19,0:l=val(l$)
  4. 4 if int(l/2)=(l/2)orl<=1then 1
  5. 5 dim f(l,l):z=(l+3)/2:s=(l+1)/2:f(z,s)=1:for x=2 to l*l
  6. 6 if z+1>l and s+1>l then z=2:s=l:goto12
  7. 7 if s+1>l then s=1:z=z+1:goto12
  8. 8 if z+1>l then z=1:s=s+1:goto12
  9. 9 if f(z+1,s+1)<>0 and z+2>l then z=1:goto12
  10. 10 if f(z+1,s+1)<>0 and z+2<=l then z=z+2:goto12
  11. 11 iff(z+1,s+1)=0thenz=z+1:s=s+1:
  12. 12 f(z,s)=x:nextx:print:print:print"   drucker (j/n)"
  13. 13 geta$:ifa$="j"then18
  14. 14 ifa$=""then13
  15. 15 print"[147]":forx=1tol:fory=1tol
  16. 16 print f(x,y);:if f(x,y)<10thenprint" ";
  17. 17 :nexty:print:print:nextx:end
  18. 18 open1,4:forx=1tol:fory=1tol
  19. 19 print#1,f(x,y);:if f(x,y)<10thenprint#1," ";
  20. 20 nexty:print#1," ":print#1,"":nextx:close1
  21.