home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 212
/
212.d81
/
b.triangulation
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
6KB
|
157 lines
10 ifl=0thenl=1:load"tri.ml",8,1
20 ifl=1thenl=2:load"tri.fnt",8,1
30 poke52,128:poke56,128:clr:gosub1310:gosub1010:gosub1110:gosub810:gosub1210
40 gosub1260:sysclear:qn=nt:iff<>0then60
50 gosub1610:ife<0then70
51 ife>0then60
55 gosub1510:qn=qn-1:if(e<>0)or(qn=0)then80
60 gosub2010:qn=qn-1:if(e=0)and(qn<>0)then50
70 poke646,gc:printd$;:poke646,fg:print"]]i[157][157][157]]won";:goto90
80 poke646,gc:printd$;:poke646,fg:print"]you[157][157][157][157]]won";
90 fori=1to2000:next:gosub1110:gosub610:gosub1210:goto40
500 rem print options screen
510 poke646,fg:print"[147]<::::::::::::::::::::::::::::::::="
515 print";]]]]]]]]]select]options]]]]]]]]];"
520 print";]]]]]]]]]]]]]]]]]]]]]]]]]current;"
525 print";]f1]]change]size]]]]]]]]]]]]";chr$(48+si);"]]];"
530 print";]f2]]list]instructions]]]]]]]]]];"
535 print";]f3]]change]color]scheme]]]]]]]];"
540 print";]f4]]change]who]starts]]]]]";
545 iff=0thenprint"you]];"
550 iff=1thenprint"me]]];"
555 print";]f5]]change]strategy]]]]]]";
560 ifl2=l1thenprint"]open];"
565 ifl2<>l1thenprint"closed;"
570 print";]f7]]play]game]]]]]]]]]]]]]]]]]];"
575 print";]f8]]return]to]loadstar]]]]]]]]];"
580 print">::::::::::::::::::::::::::::::::?"
585 return
600 rem get options
610 gosub510
615 geta$:ifa$=""then615
620 a=asc(a$):ifa=137thengosub3010:goto610
625 ifa=133thensi=si-1-4*(si=4):pokel1,si-1:sysresize:nt=si*(si+1)/2:goto610
630 ifa=134thengosub710:goto610
635 ifa=138thenf=1-f:goto610
640 ifa=135thenl2=l2+2+4*(l2>=l3):goto610
645 ifa=136thenreturn
650 ifa<>140then610
655 gosub1410:poke52,160:poke56,160:clr
660 open15,8,15,"r0:hello connect=hello connect":input#15,er%:close15
665 ifer%<>63thenend
670 load"hello connect",8
700 rem set colors
710 readbg:ifbg<0thenrestore:readbg
720 readfg,df,gc,tc(1),tc(2),tc(3),tc(4):poke53280,bg:poke53281,bg
730 poke53282,gc:poke646,gc:forz=0to27:c(z)=df:next:return
740 data 0, 1,11, 4, 7, 7, 7, 7
750 data 5, 1,11,13, 0, 0, 0, 0
760 data 0, 1,14,12, 1, 6, 5, 2
770 data11, 1, 0,12,15,15,15,15
780 data 6, 0, 3,14, 1, 1, 1, 1
785 data 2, 7,10, 8, 1, 1, 1, 1
790 data -1
800 rem title screen
810 si=5:gosub1210:print""
820 print"<::::::::::::::::::::::::::::::::::="
830 print";]triangulation]]by]dave]johannsen];"
840 print";]@]1990]]published]on]loadstar]72];"
850 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];"
860 print";]]]]]]press]any]key]to]begin]]]]]];"
870 print">::::::::::::::::::::::::::::::::::?"
880 geta$:ifa$<>""thensi=7:gosub610:return
890 pokeg(k1),39:pokeg(k2),39:pokeg(k3),39
900 j=int(rnd(1)*34):pokel1,j:sysresize+3
910 j=int(rnd(1)*4+1):k1=peek(l1+1):k2=peek(l1+2):k3=peek(l1+3)
920 pokeh(k1),tc(j):pokeg(k1),j+43:pokeh(k2),tc(j):pokeg(k2),j+43
930 pokeh(k3),tc(j):pokeg(k3),j+43:forj=1to400:next:goto880
1000 rem initialize vars
1010 clear=49152:set=49155:move=49158:resize=49161:l1=49167:l2=l1:l3=49169
1020 size=7:dimg(28),s(28),d(28),c(28),h(28):nt=si*(si+1)/2
1030 z=0:fory=1to7:forx=1toy:g(z)=34829+118*y+4*x:d(z)=z+1:z=z+1:nextx,y
1040 forz=0to27:c(z)=df:h(z)=g(z)+20480:next:gosub710
1050 d$="<::::::=[157][157][157][157][157][157][157][157]"
1060 d$=d$+";]]]]]];[157][157][157][157][157][157][157][157];]]]]]];[157][157][157][157][157][157][157][157];]]]]]];[157][157][157][157][157][157][157][157];]]]]]];[157][157][157][157][157][157]"
1070 d$=d$+"[157][157]>::::::?[157][157][157][157][157][157][157][145][145][145][145]":return
1100 rem reset symbol array
1110 forz=0to27:s(z)=d(z):c(z)=df:next:return
1200 rem draw screen
1210 a$="<:":b$=";!":c$=">:"
1215 fory=1tosi:a$=a$+"::::":b$=b$+"!!!!":c$=c$+"::::":next
1220 a$=a$+"=":b$=b$+";":c$=c$+"?":poke646,gc:print"[147]";
1225 printtab(14-2*si);a$:fory=3*si+2to1step-1:printtab(14-2*si);b$:next
1230 printtab(14-2*si);c$;"":s$="#$%[157][157][157]&'([157][157][157])*+[145][145]"
1235 fory=1tosi:printtab(16-2*y);:forx=1toy:prints$;:next:print"":next:return
1250 rem draw menu
1260 forz=si*(si+1)/2-1to0step-1:pokeg(z),s(z):pokeh(z),c(z):next
1265 print"";tab(33);"<::::=":forz=1to4:printtab(33);";!#$%;"
1270 printtab(33);";]&";:poke34810+120*z,112+z:poke55290+120*z,bg
1275 poke646,tc(z):printchr$(43+z);:poke646,gc:print"(;"
1280 printtab(33);";!)*+;":next:printtab(33);">::::?":return
1300 rem switch to new font
1310 poke56578,peek(56578)or3:poke56576,(peek(56576)and252)or1:poke53272,32
1320 poke648,136:print"[147]";:poke53265,peek(53265)or64:return
1400 rem switch back to normal font
1410 poke56578,peek(56578)or3:poke56576,peek(56576)or3:poke53272,20:poke648,4
1420 poke53280,0:poke53281,0:print"[144][147]";:poke53265,peek(53265)and191:return
1500 rem play token t in square s. e set if end of game
1510 ifs<0thenreturn
1515 s(s)=43+t:c(s)=tc(t):pokeg(s),s(s):pokeh(s),c(s)
1520 pokel1,s:pokel1+1,t:sysse:e=peek(l1):ife=0thenreturn
1530 w1=peek(l1+1):w2=peek(l1+2):w3=peek(l1+3)
1540 forz=0tont-1:if(z<>w1)and(z<>w2)and(z<>w3)thenpokeg(z),39
1550 next:e=1:return
1600 rem get players move
1610 s=-1:t=-1:e=0
1620 poke646,gc:printd$;:poke646,fg
1625 if(s>=0)and(t>0)thenprint"press[157][157][157][157][157]return";:goto1660
1630 print"select[157][157][157][157][157][157]";
1640 ift<0thenprint"token[157][157][157][157][157]";:ifs<0thenprint"and[157][157][157][157]";
1650 ifs<0thenprint"square";
1660 geta$:ifa$=""then1660
1670 a=asc(a$):if(a>48)and(a<53)then1710
1680 if(a>64)and(a<91)then1730
1690 if(a>55)and(a<58)thena=a+35:goto1730
1695 ifa=140thene=-1:return
1696 ifa=168thene=1:return
1700 on2+(a=13)goto1760,1660
1710 ift>-1thenpoke55292+120*t,tc(t)
1720 t=a-48:poke55292+120*t,fg:goto1620
1730 a=a-65:if(a>=nt)or(s(a)>29)then1620
1740 ifs>-1thenpokeh(s),df
1750 s=a:pokeh(s),fg:goto1620
1760 if(s<0)or(t<0)then1660
1770 poke55292+120*t,tc(t):pokeh(s),df:poke646,gc:printd$;"";:return
2000 rem machines move
2010 sysmove:t=peek(l2):s=peek(l2+1):gosub1510
2020 fori=1to20:pokeh(s),fg:forj=1to50:next:pokeh(s),c(s):forj=1to50:nextj,i
2030 return
3000 rem help message
3010 poke646,gc:print"[147]"
3015 print"<::::::::::::::::::::::::::::::::::::=";
3016 print";]]]]]]]]]]]triangulation]]]]]]]]]]]];";
3017 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3018 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3020 print";]1]]we]alternate]playing]on]a]]]]]]];";
3025 print";]]]]triangular]mat]]]]]]]]]]]]]]]]]];";
3026 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3030 print";]2]]we]can]place]any]token]on]the]]];";
3035 print";]]]]mat]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3036 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3040 print";]3]]whoever]forms]an]equilateral]]]];";
3045 print";]]]]triangle]wins]]]]]]]]]]]]]]]]]]];";
3046 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3050 print";]4]]an]equilateral]triangle]has]3]]];";
3055 print";]]]]equal]length]sides]]]]]]]]]]]]]];";
3056 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3060 print";]5]]f8]terminates]the]game]]]]]]]]]];";
3066 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3067 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3070 print";]]]]]]that]doesnt]sound]so]hard]]]]];";
3076 print";]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]];";
3080 print";]]]]]]press]any]key]to]continue]]]]];";
3090 print">::::::::::::::::::::::::::::::::::::?";
3100 geta$:ifa$=""then3100
3110 return
10000 open15,8,15,"i0":print#15,"s0:triangulation":close15:save"triangulation",8