home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1987 November
/
64er_Magazin_87-11_1987_Markt__Technik_de.d64
/
b-mancala
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
7KB
|
297 lines
80 poke 53280,0
90 poke 53281,0
100 print"[147]":print"[158]"
102 poke 211,0:poke 214,5:sys 58732
104 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
110 print" [221] [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201] [221]"
120 print" [221] [221] m a n c a l a [221] [221]"
130 print" [221] [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203] [221]"
150 print" [171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][179]"
152 print" [221] programmiert von : [221]"
160 print" [221] benno b o s e n [221]"
180 print" [221] lenaustrasse 10 [221]"
190 print" [221] 5216 niederkassel 2 [221]"
200 print" [221] telefon 02208/5869 [221]"
210 print" [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
970 :
980 rem @ s1024
990 :
1000 rem num. variablen
1010 b=0:ba=0:bs=0:ea=0:eb=0:ee=0:f=0
1020 g=0:gz=0:h=0:i=0:j=0:l=0:m=0:n=0
1025 k=30000
1030 q=0:r=0:s=0:t=0:t0=0:ka=0:kd=0
1040 u=0:w=0:z=0:ze=0:zg=0:zx=0
1050 :
1100 rem strings
1110 g$="":r$=""
1130 d$="[221] [221] [221] [221] [221] [221] [221]"
1150 b$=" "
1200 :
1210 rem arrays
1220 dim a%(2,6,15),n%(10)
1970 goto 5900
1980 :
1990 rem setzen
2000 z=0
2010 u=0:b=a%(l,m,n):a%(l,m,n)=0
2020 if r=0 and n=6 then a%(l,m,13)=a%(l,m,13)+1:b=b-1
2030 if r=6 and n=12 then a%(l,m,14)=a%(l,m,14)+1:b=b-1
2040 if b=0 then 2100
2050 if n=6 or n=12 then u=u+1
2060 if n=12 then n=0
2070 n=n+1:a%(l,m,n)=a%(l,m,n)+1:b=b-1
2080 if b>0 then 2020
2100 if u=0 then 2190
2105 rem kette oder kapern ?
2110 if 10*u/2-int(u/2)*10=0 then z=z+1:n%(z)=n:goto 2010
2120 b=a%(l,m,n)
2130 if b<2 or b>3 then 2190
2140 z=z+1:n%(z)=n:a%(l,m,n)=0
2150 if n<7 then a%(l,m,14)=a%(l,m,14)+b:goto 2170
2160 a%(l,m,13)=a%(l,m,13)+b
2170 if n=1 or n=7 then 2190
2180 n=n-1:goto 2120
2190 ze=z:return
2480 :
2490 rem verzweigung
2500 for m=1 to 6
2510 : if a%(s,t,m+r)=0 then 2615
2520 : for n=0 to 14
2530 : a%(l,m,n)=a%(s,t,n)
2540 : next n
2550 : n=m+r
2560 : gosub 2000
2562 if r=0 then ka=13:goto 2566
2564 ka=14
2566 kd=a%(l,m,ka)-a%(0,0,ka)
2568 : a%(l,m,15)=a%(l,m,13)-a%(l,m,14)+kd
2570 : gosub 3000
2580 : if ea=0 then 2600
2590 : if r=0 then a%(l,m,15)=60:ee=1:goto 2620
2595 : goto 2615
2600 : if eb=0 then 2630
2610 : if r=6 then a%(l,m,15)=-60:ee=1:goto 2620
2615 : a%(l,m,0)=0
2620 : ea=0:eb=0
2630 next m
2640 return
2980 :
2990 rem spielende ?
3000 if a%(l,m,13)=>6*ba then ea=1:goto 3100
3010 if a%(l,m,14)=>6*ba then eb=1:goto 3100
3030 bs=0
3040 for n=1 to 12
3050 : bs=a%(l,m,n)+bs
3060 : if n=6 and bs=0 then eb=1
3070 : if n=6 then bs=0
3080 : if n=12 and bs=0 then ea=1
3090 next n
3100 return
3480 :
3490 rem auswahl
3500 if r=0 then w=-60:goto 3520
3510 w=60
3520 for m=1 to 6
3530 : if a%(l,m,0)=0 then 3570
3540 : if r=0 and a%(l,m,15)<w then 3570
3550 : if r=6 and a%(l,m,15)>w then 3570
3560 : w=a%(l,m,15)
3570 next m
3580 z=0
3590 for m=1 to 6
3600 : if a%(l,m,0)=1 and a%(l,m,15)=w then z=z+1:n%(z)=m
3610 next m
3620 if z=1 then 3650
3640 ze=z:z=int(rnd(1)*ze)+1
3650 q=n%(z)
3660 return
3980 :
3990 rem ausgabe
4000 poke 211,7:poke 214,7:sys 58732:print d$;
4010 for n=1 to 6
4030 : poke 211,38-5*n:sys 58732:print a%(l,m,n);
4050 next n
4060 poke 211,3:sys 58732:print a%(l,m,13)
4090 poke 211,2:poke 214,15:sys 58732:print d$;
4100 for n=7 to 12
4120 : poke 211,5*(n-6)-2:sys 58732:print a%(l,m,n);
4140 next n
4150 poke 211,33:sys 58732:print a%(l,m,14)
4170 if ze=0 then 4290
4175 rem kennz.kette / kapern
4180 for z=1 to ze
4190 : if n%(z)>6 then 4240
4200 : poke 214,6:poke 211,40-5*n%(z):sys 58732:print"[215]";:goto 4280
4240 : poke 214,16:poke 211,5*(n%(z)-6):sys 58732:print"[215]";
4280 next z
4290 return
4480 :
4490 rem zuggenerator
4500 if r=6 then poke 211,0:poke 214,1:sys 58732:print b$
4510 if r=0 then poke 211,0:poke 214,21:sys 58732:print b$
4520 if r=0 then poke 211,0:poke 214,1:sys 58732:print" a denkt";
4530 if r=6 then poke 211,0:poke 214,21:sys 58732:print" b denkt";
4540 s=0:t=0:l=0:gz=1
4550 gosub 2500
4560 if gz=g or ee=1 or zg<2 then ee=0:goto 4760
4570 for t0=1 to 6
4580 : print t0;
4590 : if a%(s,t0,0)=0 then 4740
4600 : t=t0
4610 : gz=gz+1:l=1
4620 : if r=6 then r=0:goto 4640
4630 : r=6
4640 : gosub 2500
4650 : gosub 3500
4660 : if r=6 then r=0:goto 4680
4670 : r=6
4680 : if ee=1 then 4730
4690 : s=1:t=q:l=2
4700 : gosub 2500
4710 : gosub 3500
4720 : if gz<g and ee=0 then s=2:t=q:l=1:goto 4610
4730 : a%(0,t0,15)=w:s=0:gz=1:ee=0
4740 next t0
4750 l=0
4760 gosub 3500
4770 n=q+r:m=0
4780 print" und setzt !";
4790 poke 54290,21
4800 poke 54290,20
4810 return
4830 return
4980 :
4990 rem eingabe
5000 poke 211,0:poke 214,1:sys 58732
5010 if r=0 then print" spieler a setzt !"
5020 if r=6 then print b$
5030 poke 211,0:poke 214,21:sys 58732
5040 if r=6 then print" spieler b setzt !"
5050 if r=0 then print b$
5060 get g$:if g$=" "then 5060
5070 q=val(g$):if q<1 or q>6 then 5060
5075 poke 211,0:poke 214,23:sys 58732:print b$
5080 n=q+r:l=0:m=0
5090 if a%(l,m,n)>0 then 5190
5095 poke 54290,21
5100 poke 54290,20
5105 poke 211,3:poke 214,23:sys 58732
5110 print"feld ist null ! - neu setzen !"
5130 poke 54290,21
5140 poke 54290,20
5180 goto 5060
5190 return
5880 :
5890 rem vorprg
5900 poke 160,0:poke 161,0:poke 162,0
5910 f=ti+150
5920 if ti<f then 5920
5940 rem gong/stimme 3
5950 for j=24272 to 24296:poke k+j,0:next
5960 poke 54287,15
5970 poke 54291,48:poke 54292,140
5980 poke 54294,110:poke 54295,247
5990 poke 54296,31
6020 print"[147]"
6030 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
6040 print" [171][192][192][192][192][192][201] spieler a [221]"
6050 print" [221]k [171][192][192][192][192][178][192][192][192][192][178][192][192][192][192][178][192][192][192][192][178][192][192][192][192][178][192][192][192][192][201][221]"
6060 print" [221]a [221] [221] [221] [221] [221] [221] [221][221]"
6070 print" [221]l [221] [221] [221] [221] [221] [221] [221][221]"
6080 print" [221]a [221] [221] [221] [221] [221] [221] [221][221]"
6090 print" [221]h a 6 5 4 3 2 1 [182][146][221]"
6100 print" [171][192][192][192][192][192][203] [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201] [221]"
6110 print" [221] [221] m a n c a l a [221] [221]"
6120 print" [221] [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203] [213][192][192][192][192][192][179]"
6130 print" [221][181] 1 2 3 4 5 6 b[146] k[221]"
6140 print" [221][221] [221] [221] [221] [221] [221] [221] a[221]"
6150 print" [221][221] [221] [221] [221] [221] [221] [221] l[221]"
6160 print" [221][221] [221] [221] [221] [221] [221] [221] a[221]"
6170 print" [221][202][192][192][192][192][177][192][192][192][192][177][192][192][192][192][177][192][192][192][192][177][192][192][192][192][177][192][192][192][192][179] h[221]"
6180 print" [221] spieler b [202][192][192][192][192][192][179]"
6190 print" [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
6210 print" grundwerte der felder (3-9):";
6220 get g$:if g$=" "then 6220
6225 ba=val(g$):if ba<3 or ba>9 then 6220
6230 print ba
6240 print" anzahl spieler ? (0-2)";
6250 get g$:if g$="" then 6250
6255 i=val(g$):if i<0 or i>2 then 6250
6260 print i
6270 print" wer beginnt (a/b) ?";
6280 get r$:if r$="a"or r$="b"then 6290
6285 goto 6280
6290 print" ";r$
6300 if i=2 then 6350
6320 print" spielstaerke zuggenerator (1-4):";
6330 get g$:if g$=" "then 6330
6340 g=val(g$):if g<1 or g>4 then 6330
6345 print g
6350 poke 211,4:poke 214,11:sys 58732:print"*";ba;"*"
6360 for n=1 to 12:a%(l,m,n)=ba:next n
6370 a%(l,m,0)=1
6380 for n=13 to 15:a%(l,m,n)=0:next n
6385 gosub 4000
6390 f=ti+120
6395 if ti<f then 6395
6400 poke 211,0:poke 214,20:sys 58732
6405 for zx=1 to 4:print b$:next
6410 if r$="b" then r=6
6415 if r$="a" then r=0
6480 :
6490 rem hauptprogramm
6500 if i=0 or(i=1 and r=0)then gosub 4500:goto 6540
6520 gosub 5000
6540 : poke 211,7:poke 214,6:sys 58732:print d$
6550 poke 211,2:poke 214,16:sys 58732:print d$
6560 if r=0 then 6580
6570 poke 211,5*(n-6)-1:poke 214,16:sys 58732:print"[209]":goto 6585
6580 poke 211,39-5*n:poke 214,6:sys 58732:print"[209]"
6583 poke 160,0:poke 161,0:poke 162,0
6585 f=ti+90
6588 if ti<f then 6588
6590 zg=zg+1
6600 gosub 2000
6610 gosub 4000
6620 gosub 3000
6630 if ea=1 or eb=1 then 6660
6635 if r=6 then r=0:goto 6500
6640 r=6:goto 6500
6645 :
6650 rem ende
6660 poke 211,6:poke 214,20:sys 58732
6670 if ea=1 then print"spieler a hat"
6675 if eb=1 then print"spieler b hat"
6680 print" nach";zg;"zuegen gewonnen !"
6685 for j=24272 to 24296:poke k+j,0:next j
6730 if eb=1 then 6790
6732 rem triller/st1
6735 poke 54278,240:poke 54296,15
6740 poke 54276,17
6745 for j=1 to 3
6750 h=1:f=ti
6755 poke 54273,h
6760 h=h+10
6765 if ti<f+h/2 then 6765
6770 if h<125 then 6755
6775 next j
6780 poke 54276,16
6785 goto 6855
6787 rem dreiklang
6790 poke 54272,103:poke 54273,17
6795 poke 54277,31:poke 54278,13:poke 54296,15
6800 poke 54276,17
6805 f=ti
6810 if ti<f+30 then 6810
6815 poke 54279,237:poke 54280,21
6820 poke 54284,31:poke 54285,13:poke 54283,17
6830 if ti<f+60 then 6830
6835 poke 54286,20:poke 54287,26
6840 poke 54291,31:poke 54292,13:poke 54290,17
6855 print" neues spiel (j/n) ?"
6857 if ti<f+180 then poke 54276,16:poke 54283,16:poke 54290,16
6860 get g$:if g$=""then 6860
6870 if g$="j"then ea=0:eb=0:zg=0:ze=0:goto 5950
6880 print"[147]";:end