home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 44 / 044.d81 / castrovia (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  7KB  |  247 lines

  1. 10 p=1:dl=1500:ss=54272:c$(0)="":c$(1)="[159]":c$(2)="[158]"
  2. 15 a$(0)="f":a$(1)="s":a$(2)="l":a$(3)="c"
  3. 17 a$(4)="x":poke53280,0:poke53281,0
  4. 20 gosub60100
  5. 25 gosub900:print""
  6. 26 print"     [154]press space [154]to play; q [154]to quit "
  7. 27 a=peek(203):ifa<>60anda<>62then27
  8. 28 ifa=62thengosub60000:goto26
  9. 30 print"[145]                                      [145]":poke198,.
  10. 35 print"[154]enter player one's name:";:gosub60500:n1$=b$:poke198,.
  11. 40 print"[145][154]enter player two's name:      [157][157][157][157][157][157]";:gosub60500:n2$=b$
  12. 45 dim m (9,9),p(9,9),t(9,9),c(9,9),r(2)
  13. 50 print"[145]              setting up map          ":s=1
  14. 55 fory=1to9:forx=1to9
  15. 60 n=int(40*rnd(1)+1)
  16. 65 m(x,y)=0
  17. 70 ifn<8thenm(x,y)=1
  18. 75 ifn<4thenm(x,y)=2
  19. 80 p(x,y)=0
  20. 85 ifm(x,y)=0thenp(x,y)=int(9*rnd(1)+1)
  21. 90 t(x,y)=0:c(9,9)=0
  22. 95 nextx,y
  23. 100 m(5,5)=4
  24. 105 p(5,5)=int(5*rnd(1)+5)
  25. 110 print"[147]":gosub430
  26. 115 gosub490:print"[154]is this map allright with both":print"players (y[154]/n[154])?"
  27. 120 geta$:ifa$="y"thens=0:goto135
  28. 125 ifa$="n"thenprint"[145][145]";:fora=1to2:print"                             ":next:goto50
  29. 130 goto120
  30. 135 gosub490:print"placing castles":forx=1to500:nextx
  31. 140 x1=int(9*rnd(1)+1):y1=int(9*rnd(1)+1)
  32. 145 y1=int(9*rnd(1)+1)
  33. 150 ifm(x1,y1)<>0then140
  34. 155 m(x1,y1)=3:c(x1,y1)=1:t(x1,y1)=9
  35. 160 x2=int(9*rnd(1)+1):y2=int(9*rnd(1)+1)
  36. 165 ifm(x2,y2)<>0then160
  37. 170 m(x2,y2)=3:c(x2,y2)=2:t(x2,y2)=9
  38. 175 gosub490:print"[159]";n1$"'s castle is at  "chr$(x1+64);y1
  39. 180 print"[158]";n2$"'s castle is at  "chr$(x2+64);y2
  40. 185 x(1)=x1:x(2)=x2:y(1)=y1:y(2)=y2:n$(1)=n1$:n$(2)=n2$
  41. 190 gosub430:p=2:n$=n2$:c$="[158]"
  42. 195 x=int(4*rnd(1)+1):ifx=4then210
  43. 200 ifp=2thenp=1:n$=n1$:c$="[159]":goto210
  44. 205 ifp=1thenp=2:n$=n2$:c$="[158]"
  45. 210 gosub490:print"[154]it's "c$n$"'s [154]move: --> from ";
  46. 215 la=65:ha=73:gosub840
  47. 220 fx=asc(a$)-64
  48. 225 la=49:ha=75:gosub840
  49. 230 fy=val(a$)
  50. 235 print:print"                        [154]to ";
  51. 240 la=65:ha=73:gosub840
  52. 245 tx=asc(a$)-64
  53. 250 la=49:ha=57:gosub840
  54. 255 ty=val(a$)
  55. 260 ifc(fx,fy)=pthen275
  56. 265 gosub490:print"[150]you have no troops there! - try again":forx=1todl:nextx
  57. 270 goto210
  58. 275 ifabs(fx-tx)<=1andabs(fy-ty)<=1then290
  59. 280 gosub490:print"[150]you can only move into an adjacent      quadrant";
  60. 285 print" -- try again":forx=1todl:nextx:goto210
  61. 290 ifm(tx,ty)<>2then305
  62. 295 gosub490:print"[150]you can't move into a lake -- try again"
  63. 300 forx=1todl:nextx:goto210
  64. 305 gosub490:print"[154]how many troops to move? --> ";
  65. 310 la=48:ha=57:gosub840
  66. 315 mn=val(a$)
  67. 320 ifmn=0thenprint" ok":goto415
  68. 325 ift(fx,fy)=>mnthen340
  69. 330 gosub490:print"not enough troops! -- try again":forx=1todl:nextx
  70. 335 goto290
  71. 340 if not(c(tx,ty)=pandt(tx,ty)+mn>9)then355
  72. 345 gosub490:print"this would result in more than nine     troops in a";
  73. 350 print" quadrant - try again":forx=1todl:nextx:goto290
  74. 355 print" ok":t(fx,fy)=t(fx,fy)-mn
  75. 360 ift(fx,fy)=0thenc(fx,fy)=0
  76. 365 ifc(tx,ty)=0orc(tx,ty)=pthent(tx,ty)=t(tx,ty)+mn:c(tx,ty)=p:goto415
  77. 370 gosub490:print"a battle!!":gosub900
  78. 375 ds=t(tx,ty)+(.5*p(tx,ty))
  79. 380 ifm(tx,ty)=3orm(tx,ty)=4thends=ds*2
  80. 385 dv=int(ds*rnd(1))
  81. 390 av=int(mn*rnd(1))
  82. 395 ifav=dvthent(tx,ty)=0:c(tx,ty)=0:goto415
  83. 400 ifdv>avthent(tx,ty)=t(tx,ty)-av
  84. 405 ifav>dvthent(tx,ty)=mn-dv:c(tx,ty)=p
  85. 410 ift(tx,ty)<1thent(tx,ty)=1
  86. 415 gosub430:gosub490
  87. 420 tu=tu+1:iftu>(int(7*rnd(1)+3))thentu=0:gosub505
  88. 425 goto195
  89. 430 print"    a   b   c   d   e   f   g   h   i"
  90. 435 print" [154][176][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][174]"
  91. 440 r(1)=0:r(2)=0:fory=1to9
  92. 445 ify<>1thenprint" [154][194]                                    [194]"
  93. 450 print""chr$(y+48)"[154][194][155]";
  94. 455 forx=1to9
  95. 460 printc$(c(x,y));p(x,y);"[157]";a$(m(x,y));chr$(t(x,y)+48)"[155]";
  96. 465 r(c(x,y))=r(c(x,y))+t(x,y):nextx
  97. 470 print"[154][194]":nexty
  98. 475 print" [173][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][189]"
  99. 480 if(r(1)=0orr(2)=0)ands=0then855
  100. 485 return
  101. 490 print"";
  102. 495 forx=1864to2023:pokex,32:nextx
  103. 500 return
  104. 505 gosub490:print"year end tax reports":ta(1)=0:ta(2)=0
  105. 510 fory=1to9:forx=1to9
  106. 515 ifc(x,y)=1thenta(1)=ta(1)+100*p(x,y)
  107. 520 ifc(x,y)=2thenta(2)=ta(2)+100*p(x,y)
  108. 525 nextx,y
  109. 530 forpp=1to2:printc$(pp)
  110. 535 ifc(x(pp),y(pp))=ppthen560
  111. 540 gosub490:print"attention "n$(pp):forx=1todl:nextx
  112. 545 gosub490:print"you can't collect taxes or buy troops   if ";
  113. 550 print"you're not in control of your castle":forx=1todl:nextx
  114. 555 goto770
  115. 560 gosub490:printn$(pp)" collected"ta(pp)"barbles"
  116. 562 print"in taxes this year"
  117. 565 forx=1todl:nextx:gosub490
  118. 570 i(pp)=int(.1*ba(pp))
  119. 575 print"and earned"i(pp)"barbles in interest"
  120. 580 forx=1todl:nextx
  121. 585 ba(pp)=ba(pp)+i(pp)+ta(pp)
  122. 590 gosub490:printn$(pp)"'s new balance is"ba(pp)"barbles"
  123. 592 forx=1todl:nextx
  124. 595 gosub490
  125. 600 print"how many castle troops do you"
  126. 603 print"want to buy (2000 barbles each)";
  127. 605 la=48:ha=57:gosub840
  128. 610 a=val(a$):ifa*2000<=ba(pp)then625
  129. 615 gosub490:print"you don't have enough money!":forx=1todl:nextx
  130. 620 goto595
  131. 625 ifa=0then660
  132. 630 ift(x(pp),y(pp))+a<10then650
  133. 635 gosub490:print"you can't have more than nine troops in a quadrant!";
  134. 640 print" - try again":forx=1todl:nextx
  135. 645 goto595
  136. 650 t(x(pp),y(pp))=t(x(pp),y(pp))+a:ba(pp)=ba(pp)-(2000*a)
  137. 655 gosub490:printc$(pp)"your new balance is"ba(pp)"barbles"
  138. 658 forx=1todl:nextx
  139. 660 gosub490
  140. 665 print"how many regular troops"
  141. 667 print"do you wish to buy (1000 barbles each)";
  142. 670 la=48:ha=57:gosub840
  143. 675 a=val(a$):ifa*1000<=ba(pp)then690
  144. 680 gosub490:print"you don't have enough money!":forx=1todl:nextx
  145. 685 goto660
  146. 690 ifa=0then770
  147. 695 gosub490:print"where do you want to put them ";
  148. 700 la=65:ha=73:gosub840
  149. 705 xx=asc(a$)-64
  150. 710 la=49:ha=57:gosub840
  151. 715 y=val(a$)
  152. 720 ifc(xx,y)=ppthen735
  153. 725 gosub490:print"you can not put troops where you do not  have any!"
  154. 730 forx=1todl:nextx:goto695
  155. 735 ift(xx,y)+a<=9then755
  156. 740 gosub490
  157. 742 print"you can not have more than nine troops  in any quadrant"
  158. 745 forx=1todl:nextx
  159. 750 goto660
  160. 754 ifxx=x(pp)andy=y(pp)thengosub490
  161. 755 ifxx=x(pp)andy=y(pp)thengosub490:gosub1000
  162. 760 ifxx=x(pp)andy=y(pp)thenprint"your castle":forx=1todl:nextx:goto660
  163. 765 t(xx,y)=t(xx,y)+a:ba(pp)=ba(pp)-1000*a:gosub490
  164. 770 nextpp
  165. 775 z=int(20*rnd(1)+1):print"[152]";
  166. 780 ifz=1thengosub490:print"all treasuries mysteriously double"
  167. 785 ifz=1thenba(1)=ba(1)*2:ba(2)=ba(2)*2
  168. 790 ifz=2thengosub490:print"all treasuries mysteriously disappear"
  169. 795 ifz=2thenba(1)=0:ba(2)=0
  170. 800 ifz=3thengosub490:print"revolution in capitol"
  171. 805 ifz=3thenprint"all troops killed":t(5,5)=0:c(5,5)=0
  172. 810 ifz<>4then830
  173. 814 gosub490
  174. 815 print"[154]castle troop's disease kills half of    all castle troops"
  175. 820 t(x1,y1)=int(t(x1,y1)/2):ift(x1,y1)=0thenc(x1,y1)=0
  176. 825 t(x2,y2)=int(t(x2,y2)/2):ift(x2,y2)=0thenc(x2,y2)=0
  177. 830 ifz>4thengosub490:print"[154]no news is good news"
  178. 835 gosub430:return
  179. 840 geta$:ifa$=""then840
  180. 842 ifa$="q"thengosub60600:goto840
  181. 845 ifasc(a$)<laorasc(a$)>hathengoto840
  182. 850 printa$;:return
  183. 855 print"[147]":ifr(1)=0thenw=2:w$=n2$:l$=n1$:goto865
  184. 860 w=1:w$=n1$:l$=n2$
  185. 865 print""w$" [154]has beaten "l$
  186. 870 print"[154]final statistics"
  187. 875 print"[159][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]":print""
  188. 880 print" ",n1$,n2$
  189. 885 print"[154]troops",r(1),r(2)
  190. 890 print"[154]barbles",ba(1),ba(2)
  191. 895 print"[154]        press space [154]to continue"
  192. 896 ifpeek(203)<>60then896
  193. 897 run
  194. 900 rem sound
  195. 905 forxx=1to5:poke ss+24,15
  196. 910 poke ss+5,9
  197. 915 poke ss+1,20
  198. 920 poke ss+4,128
  199. 925 for dd=1 to 10: next dd
  200. 930 poke ss+4,129
  201. 935 fordd=1to(50*int(10*rnd(1)+1)):nextdd,xx
  202. 940 forxx=sstoss+24:pokexx,o:nextxx
  203. 945 poke ss+24,7
  204. 950 poke ss+5,12*16+0
  205. 955 poke ss+6,15*16+10
  206. 960 for xx= 255 to 100step -1.4
  207. 965 poke ss+1,xx
  208. 970 poke ss+4,17
  209. 975 next xx
  210. 980 poke ss+24,15
  211. 985 poke ss+1,15
  212. 990 poke ss+4,128
  213. 995 forxx=1to900:nextxx:forxx=sstoss+24:pokexx,0:nextxx:return
  214. 1000 print"you can't put regular troops in ":return
  215. 60000 print"[145]  [154]are you sure you