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