home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 186 / 186.d81 / bridge (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  20KB  |  593 lines

  1. 1 rem    ***** bridge *****
  2. 5 dv=peek(186):ifdv<8thendv=8
  3. 40 sys57812"f.bridge",dv,0:poke780,0:poke781,0:poke782,8:sys65493
  4. 60 clr:dv=peek(186):ifdv<8thendv=8
  5. 100 rem    **** set variables *****
  6. 105 ad=49152:ag=4096:s=54272:poke53272,19:printchr$(14):printchr$(8)
  7. 110 a$="":at=0:b$="":bh$="":bd=0:bk=0:bl=0:c$="":cd%=0
  8. 115 ch=0:cs=0:ct=0:d=0:df$="":dl$="":dr=0:ds=0:el%=0:ev%=0:
  9. 120 f%=0:fc%=0:fl%=0:fu%=0:ft%=1000:gl%=0:gt=0:gw=0:k=0
  10. 130 ms$="":nm$="":pc%=0
  11. 135 q=0:q$=chr$(34):qf=0:rn%=0:se%=0:ra%=0
  12. 140 sd%=0:sn%=0:p%=0:sz=0:ts%=0:tv%=0:us%=0
  13. 145 v=0:w$="":x=0:y=0:z=0:zs=0:x$=""
  14. 150 dima$(24),gl$(99),l1%(48),l2%(48),md$(2,20),sd$(5),sp$(5),zl(5)
  15. 155 dimst%(48),ub%(48),fl$(3),vt%(3,4),fm%(3)
  16. 160 dl%(1)=1:dl%(2)=12:dl%(3)=24:dl$(1)="[211][197][195][212][207][210] =":dl$(2)=":[199][210][201][196] = "
  17. 165 dl$(3)=":%[198][213][197][204] =":hd$(1)="[204]iverpool.":hd$(2)="[211]outhampton.":
  18. 170 hd$(3)="on the rocks":hd$(4)="by enemy action":he$(1)="due":he$(2)="and"
  19. 175 sa%(1)=-1:sa%(2)=1:sa%(3)=-9:sa%(4)=9:sa%(5)=-10:sa%(6)=10:sa%(7)=-11
  20. 180 sa%(8)=11:fl$(1)=".ex":fl$(2)=".fc":fl$(3)=".ag"
  21. 185 kf$="[136][140][133][135][134]^_[138][139][137]*"
  22. 190 sd$(1)="[206]orth":sd$(2)="[206]ortheast":sd$(3)="[211]outheast":sd$(4)="[211]outh"
  23. 195 sd$(5)="[197]ast":sp$(1)="5 [203]nots":sp$(2)="10 [203]nots":sp$(3)="15 [203]nots"
  24. 200 sp$(4)="20 [203]nots":sd$(0)="[211]topped":sp$(0)="[200]ove to"
  25. 205 vt%(1,4)=120:vt%(1,3)=180:vt%(1,2)=240:vt%(1,1)=300
  26. 210 vt%(2,4)=180:vt%(2,3)=240:vt%(2,2)=300:vt%(2,1)=360
  27. 215 vt%(3,4)=240:vt%(3,3)=300:vt%(3,2)=360:vt%(3,1)=420:fm%(1)=-10:fm%(2)=-20
  28. 800 rem    ***** startup *****
  29. 805 ms$="[207]rganizing [206]avigation [205]aps.[144]":v=10:gosub5210
  30. 810 df$="ac.game":dr=dv:gosub5115:ifpr<>3then5515
  31. 815 open3,dv,3,"l:"+df$:input#3,nm$,b$,a$:close3:ra%=val(a$):gosub5740
  32. 820 gosub7705:ifqf<>1thengoto5515
  33. 825 df$="navigation data":dr=dv:gosub5115:ifpr<>3then5505
  34. 830 open3,dv,3,"l:"+df$+",p,r"
  35. 835 forx=0to1:fory=0to20:input#3,md$(x,y):next:next
  36. 840 forx=0to99:input#3,gl$(x):next:close3
  37. 1000 rem    ***** bridge *****
  38. 1005 print"[147]":bd=1:bk=1:ch=0:gosub5005
  39. 1010 zs=2:gosub6105:ms$=md$(0,0):gosub5208
  40. 1015 h=8:forv=2to16:ms$=md$(0,v-1):gosub5070:next
  41. 1020 h=3:v=7:ms$=md$(0,16):gosub5070:h=32:v=5:ms$=md$(0,17):gosub5070
  42. 1025 v=9:ms$=md$(0,18):gosub5070:h=1:forv=17to18:ms$=md$(0,v+2):gosub5070:next
  43. 1030 gosub5225:ss=5:ss$="s":gosub5405
  44. 1032 gosub6955
  45. 1035 gosub1405:gosub1410
  46. 1040 ifse%<>100thengosub1445:goto1060
  47. 1045 ms$="[217]ou are in [200]alifax [200]arbour.":gosub5208
  48. 1050 ms$="[193]ny key exits harbour.":cs=4:q=0:gosub5300:sp%=1:sd%=5:se%=2:gl%=40
  49. 1055 gosub1445:forx=0to5:gosub1505:next
  50. 1060 gosub1805:gosub5034:as$="[195]hange [195]ourse/[211]peed? (c/s)"
  51. 1070 gosub1415:gosub1420:gosub1425:gosub1430:gosub1375
  52. 1075 ms$=as$:gosub5205:zs=3
  53. 1100 ch$="cs":gosub6505:onqfgoto1105,1175,1100,1705,1100,3205,1170,1140
  54. 1105 iff%=2then1125
  55. 1110 gosub5034:ms$="[195][207][213][210][211][197]: 1 = [206]orth, 2 = [206]ortheast,":gosub5206
  56. 1115 ms$="3 = [211]outheast, 4 = [211]outh, 5 = [197]ast.":gosub5205
  57. 1120 ch$="12345":gosub6510:sd%=f%:gosub1420:gosub5034:goto1060
  58. 1125 gosub5034:ms$="[211][208][197][197][196](knots): [193] = 5, [194] = 10,":gosub5206
  59. 1130 ms$="[195] = 15, [196] = 20.":gosub5205
  60. 1135 ch$="abcd":gosub6510:sp%=f%:ifds%<>0andsp%>1thensp%=sp%-1
  61. 1137 gosub5034:goto1060
  62. 1140 gosub5034:mn%=sp%
  63. 1145 gosub1505:onsd%gosub3005,3105,3135,3035,3065
  64. 1150 a=qf/2:onagoto1205,1705,3205
  65. 1155 gosub1450:mn%=mn%-1:gosub1235:ifmn%<1then1060
  66. 1160 goto1145
  67. 1170 gosub5034:gosub5245:goto5515
  68. 1175 gosub5034:gosub5245:goto5505
  69. 1200 rem    ***** lost convoy *****
  70. 1205 lv%=tv%/2:tv%=tv%-lv%:gosub5034
  71. 1210 ms$="[217]ou loose "+str$(lv%)+" ships due to bad":gosub5206
  72. 1215 ms$="weather and faulty navigation.":gosub5205
  73. 1220 ms$="[195]onvoy stops to regroup. [193]ny key.":cs=4:q=0:v=24:gosub5305
  74. 1225 gosub5034:sp%=0:sd%=0:gosub1405:gosub1415:gosub1420:goto1060
  75. 1230 rem    ***** sailing problems *****
  76. 1235 e=1:ifst%(se%)=1andub%(se%)=1thene=3:b%=l1%(se%):d%=l2%(se%):goto1265
  77. 1240 ifst%(se%)=1thenb%=l1%(se%):goto1265
  78. 1245 ifub%(se%)=1thend%=l2%(se%):goto1270
  79. 1250 return
  80. 1260 rem    ***** problem filter/action *****
  81. 1265 c%=0:a%=b%:d=1:a=0:gosub1290:ifa=1then1275
  82. 1270 c%=0:a%=d%:d=2:a=0:gosub1290:ifa=1then1275
  83. 1272 gosub5043:return
  84. 1275 gosub1305
  85. 1276 gosub6020:rn%=rnd(0)*4+1:ifrn%<>c%thenondgosub1355,1365
  86. 1280 ife=3andd=1then1270
  87. 1281 gosub5034:return
  88. 1290 ifgl%=a%thenc%=2:a=1:return
  89. 1291 forx=1to8:ifgl%=(a%+sa%(x))thenc%=1:x=8:next:a=1:return
  90. 1295 return
  91. 1300 rem    ***** warnings/course change *****
  92. 1305 ms$="[217]ou are entering a storm.":cn=2
  93. 1307 ifd=2thenms$="[217]ou are in a [213]-boat area.":cn=4
  94. 1310 gosub2005:gosub5205:rn%=rnd(0)*5+1:ifrn%=sd%thenreturn
  95. 1312 a=1
  96. 1315 a%=rnd(0)*8+1:b%=gl%+sa%(a%)
  97. 1320 ifb%>9andb%<90thengl%=b%:gosub1445:goto1335
  98. 1325 a=a+1:ifa<5then1315
  99. 1326 return
  100. 1335 gosub6010:a$="[211]torm path":ifd=2thena$="[213]-boat sighting"
  101. 1340 ms$=a$+" causes course change.":gosub5206:sd%=rn%:gosub1415
  102. 1345 return
  103. 1350 rem    ***** losses *****
  104. 1355 cn=2:gosub2005:rn%=rnd(9)*2+1:ifrn%=2then1358
  105. 1356 ms$="[211]torm damage to "+str$(c%)+" vessel(s).":ifsp%>1thensp%=sp%-1
  106. 1357 ds%=ds%+c%:goto1360
  107. 1358 ms$="[211]torm sinks"+str$(c%)+" vessel(s).":tv%=tv%-c%
  108. 1360 gosub5206:gosub1405:gosub1420:gosub1425
  109. 1361 gosub6020:gosub5034:ife=3then1270
  110. 1362 return
  111. 1365 forf=1toc%:cn=3:gosub2005:nextf
  112. 1366 ms$="[213]boats sink "+str$(c%)+" vessel(s).":tv%=tv%-c%:gosub5206
  113. 1367 gosub1405:gosub6020:goto5034
  114. 1370 rem    ***** hq alert *****
  115. 1375 ms$="[198]8 = [200][209] obstacle reports.":v=18:goto5210
  116. 1380 rem    ***** fuel consumption *****
  117. 1385 qf=1:fc%=fc%+mf%:fu%=(1000-fc%)*100/1000:iffu%<1thenfu%=0:qf=4
  118. 1390 q=8:ifqf<>4andmf%<10then1475
  119. 1395 return
  120. 1400 rem    ***** print status data *****
  121. 1405 a$=str$(tv%):v=6:goto1435
  122. 1410 a$=str$(ev%):v=7:goto1435
  123. 1415 a$=sd$(sd%):v=8:goto1435
  124. 1420 a$=sp$(sp%):v=9:goto1435
  125. 1425 a$=str$(ds%):v=10:goto1435
  126. 1430 a$=str$(us%):v=11
  127. 1435 h=28:ms$="         ":gosub5070:ms$=a$:goto5070
  128. 1440 rem    ***** print status line *****
  129. 1445 gosub5040:forx=1to3:h=dl%(x):ms$=dl$(x):gosub5070:next
  130. 1450 a%=1:q=8
  131. 1455 ona%goto1460,1465,1475
  132. 1460 h=9:e$="   ":a$=str$(se%):goto1480
  133. 1465 h=20:e$="   ":a$=gl$(gl%):goto1480
  134. 1475 h=32:e$="    ":a$=str$(fu%):goto1480
  135. 1480 v=0:ms$=e$:gosub5070:ms$=a$:gosub5070:ifq<>8thenreturn
  136. 1485 a%=a%+1:ifa%<4then1455
  137. 1490 return
  138. 1500 rem    ***** set/unset problem locations *****
  139. 1505 pl%=4-ra%:ss=0:ms$="[210]eviewing situation - be patient.":gosub5205
  140. 1510 a%=ra%:ot=ot+1:ifot>3thenot=1
  141. 1511 rn%=rnd(0)*48+1
  142. 1512 onotgoto1515,1520,1525
  143. 1515 st%(rn%)=0:l1%(rn%)=0:a%=a%-1:ifa%=0then1530
  144. 1516 goto1511
  145. 1520 ub%(rn%)=0:l2%(rn%)=0:a%=a%-1:ifa%=0then1530
  146. 1521 goto1511
  147. 1525 ds%=ds%-ra%:ifds%=<0thends%=0
  148. 1526 gosub1425
  149. 1530 pa%=pa%+1:ifpa%=3thenpa%=1
  150. 1535 qf=1:sn%=rnd(0)*48+1:ifsn%<7orsn%=se%then1535
  151. 1540 ifpa%=1then1550
  152. 1545 st%(sn%)=1:goto1555
  153. 1550 ub%(sn%)=1
  154. 1555 rn%=rnd(0)*88+1:forx=1to8:ifrn%>x*10andrn%<x*10+9then1560
  155. 1557 next:goto1555
  156. 1560 x=8:next:ifpa%=1then1570
  157. 1565 l1%(sn%)=rn%:goto1575
  158. 1570 l2%(sn%)=rn%
  159. 1575 ss=ss+1:ifss<pl%then1530
  160. 1580 goto5043
  161. 1600 rem    ***** search/attack *****
  162. 1605 ifev%<1thenms$="[206]o escorts. [193]ny key.":cs=4:q=0:goto5300
  163. 1606 ss=6:ss$="s":gosub5405:gosub1825:gosub5610:gosub1765
  164. 1607 gosub1445:ms$="[195]onvoy status above.":v=2:gosub5210
  165. 1609 gosub1780:gosub1475
  166. 1610 ms$="[211]elect - s,k,^, or _":gosub5205:sysad+48,"sk^_"
  167. 1611 gosub5043:iff%=4then1685
  168. 1612 iff%=3thengosub1770:goto1615
  169. 1613 onf%gosub1855,1905
  170. 1614 goto1610
  171. 1615 gosub1805:h=1:ms$="[211]earch [211]ector =":gosub5043:gosub5070:gosub6180
  172. 1620 h=18:v=23:gosub5015:ll=2:gosub5715:ifw$=""then1609
  173. 1622 a=1:forx=1to2:ifmid$(w$,x,1)<chr$(48)ormid$(w$,x,1)>chr$(57)thena=2
  174. 1623 next:ifa=2then1615
  175. 1624 ss%=val(w$):ifss%<0orss%>48then1615
  176. 1625 h=1:ms$="[211]earch [199]rid location =":gosub5043:gosub5070:gosub6180
  177. 1630 h=24:v=23:gosub5015:ll=2:gosub5715:ifw$=""then1609
  178. 1632 a=1:forx=1to2:ifmid$(w$,x,1)<chr$(48)ormid$(w$,x,1)>chr$(57)thena=2
  179. 1633 next:ifa=2then1625
  180. 1634 sg%=val(w$):ifsg%<0orsg%>99then1625
  181. 1635 ifss%=se%then1646
  182. 1640 ar%=se%/7:ifss%>ar%+7then1646
  183. 1645 ms$="[194]ad choice. [212]ry again. [193]ny key.":cs=4:q=0:gosub53