home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 212 / 212.d81 / b.triangulation (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  157 lines

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