home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 210
/
210.d81
/
tw.game
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
16KB
|
403 lines
100 rem trail west game
110 rem and window magic routines
120 rem trail west copyright 1987
130 rem window magic copyright 1986
140 rem by richard f. daley
150 rem
160 rem may be copied for personal use only
170 rem any form of sale or distribution
180 rem without permission is forbidden.
190 rem
200 poke 53280,13: poke 53281,11: sys 14848: a=rnd(rnd(-ti))
210 rem
220 rem *** initialization segment ***
230 rem
240 print "[147]";chr$(142);chr$(8): gosub 3930
250 dim bd%(10,13),cc(5),sh%(5,4),nm$(5),pn$(4),s(5),sp%(5),as%(5)
260 dim xb%(4,5),yb%(4,5),pc%(10,13),bc%(8)
270 for i=1 to 5
280 for j=1 to 4: sh%(i,j)=0: xb%(j,i)=-1: yb%(j,i)=-1: next j
290 ts(i)=0: sp%(i)=100: as%(i)=0: cc(i)=6000: next i
300 nm$(1)="[150]apache courier ltd": nm$(2)="[156]buffalo freight"
310 nm$(3)="[152]canyon shipping co": nm$(4)="[154]denver stage inc"
320 nm$(5)="[153]eldorado express": (NULL)
330 ex$(1)="[150]aph": ex$(2)="[156]buf": ex$(3)="[152]cny": ex$(4)="[154]dnv": ex$(5)="[153]eld"
340 tk$="[146].[146]+[158][146][218][150]a[156]b[152]c[154]d[153]e": sp=0
350 cd$=""
360 jy$="[158][213][195][195][195][201][157][157][157][157][157][194][194][157][157][157][157][157][202][195][195][195][203]"
370 bj$="[158] [157][157][157][157][157] [157][157][157][157][157] "
380 bl$=" ": bl$=bl$+bl$
390 for i=1 to 9: for j=1 to 12: pc%(i,j)=0
400 if int(rnd(1)*20)+1<>10 then bd%(i,j)=1: goto 420
410 bd%(i,j)=3
420 next j,i: (NULL)(4,5,5,23): (NULL)(1,15,0,32,20,20)
430 t$="[150]plug a joystick into port 2, then press"
440 t$=t$+chr$(13)+"fire[146] to continue."
450 (NULL)(1,t$)
460 jv=peek(56320): fb=(jv and 16): if fb then 460
470 (NULL)(3)
480 (NULL)(13,9,4,20): (NULL)(1,14,0,32,20,20)
490 t$="[159]how many players are there (2-4)?": (NULL)(1,t$): pl=2
500 print left$(cd$,16);tab(26);pl
510 for i3=1 to 50: next i3
520 jv=peek(56320): fb=(jv and 16): jy=15-(15 and jv)
530 if fb=0 then 590
540 if jy=1 then pl=pl+1
550 if jy=2 then pl=pl-1
560 if pl<2 then pl=4
570 if pl>4 then pl=2
580 goto 500
590 print "[147][158]"
600 get a$: if a$<>"" then 600
610 for i=1 to pl: print
620 print "player";i;: input "what is your name [157][157][157][157]";pn$(i)
630 next i: print "now i[146] will decide who will go first..."
640 ma=80-(pl=3)
650 for i3=1 to 100: j3=j3+1: next i3
660 i=int(pl*rnd(1)+1): print pn$(i);" is the first player to move."
670 for i3=1 to 500: j3=j3+1: next i3
680 mv=0: (NULL): print "[147]": gosub 2190
690 ps=3000
700 p=i: goto 790
710 rem
720 rem *** main game loop ***
730 rem
740 mv=mv+1: if mv=ma then 3780
750 p=p+1: if p=pl+1 then p=1
760 rem
770 rem *** select playing pieces ***
780 rem
790 for i3=1 to 5
800 if yb%(p,i3)>0 then if xb%(p,i3)>0 then 880
810 y%=9*rnd(1)+1: x%=12*rnd(1)+1
820 if pc%(y%,x%)=1 then 810
830 for i1=i3-1 to 0 step-1
840 if y%=yb%(p,i1) then if x%=xb%(p,i1) then i1=0: next i1: goto 810
850 next i1
860 if bd%(y%,x%)>1 then 810
870 pc%(y%,x%)=1: yb%(p,i3)=y%: xb%(p,i3)=x%
880 next i3
890 rem
900 rem *** get player move ***
910 rem
920 for i3=1 to 5: mv%(i3)=0: next i3: ap=0
930 print left$(cd$,24);"";pn$(p);", your move. ": jy=1
940 t$=chr$(13)+"[159]":for i=1 to 5
950 t$=t$+str$(yb%(p,i))+" "+chr$(64+xb%(p,i))+chr$(13)+chr$(13)
960 next i: t$=t$+" stk"+chr$(13)+chr$(13)+" cal"
970 if ap=1 then t$=t$+chr$(13)+chr$(13)+" pas"
980 (NULL)(4,31,(17+2*ap),8): (NULL)(0,1,42,32,5,5)
990 (NULL)(1,t$)
1000 print left$(cd$,6+2*(jy-1));tab(32);jy$
1010 jv=peek(56320): fb=(jv and 16): jv=15-(jv and 15)
1020 if fb=0 then 1140
1030 if jv=1 or jv=2 then 1050
1040 goto 1010
1050 print left$(cd$,6+2*(jy-1));tab(32);bj$
1060 if jv=1 then jy=jy-1
1070 if jv=2 then jy=jy+1
1080 if jy<1 then jy=7+ap
1090 if jy>(7+ap) then jy=1
1100 goto 1000
1110 rem
1120 rem *** perform selected move ***
1130 rem
1140 (NULL)(3)
1150 if jy=6 then gosub 3100: goto 930
1160 if jy=7 then 3300
1170 if ap=1 then if jy=8 then 3510
1180 r=yb%(p,jy): c=xb%(p,jy)
1190 a1=bd%(r-1,c): a2=bd%(r+1,c): a3=bd%(r,c+1): a4=bd%(r,c-1)
1200 for i1=1 to 5: if as%(i1)=0 then i1=5: next i1: goto 1310
1210 next i1
1220 if a1>3 or a2>3 or a3>3 or a4>3 then 1310
1230 if a1=2 then if a2<4 then if a3<4 then if a4<4 then 3430
1240 if a2=2 then if a1<4 then if a3<4 then if a4<4 then 3430
1250 if a3=2 then if a1<4 then if a2<4 then if a4<4 then 3430
1260 if a4=2 then if a1<4 then if a2<4 then if a3<4 then 3430
1270 if a1=3 then if a2<4 then if a3<4 then if a4<4 then 3430
1280 if a2=3 then if a1<4 then if a3<4 then if a4<4 then 3430
1290 if a3=3 then if a1<4 then if a2<4 then if a4<4 then 3430
1300 if a4=3 then if a1<4 then if a2<4 then if a3<4 then 3430
1310 yb%(p,jy)=-1: xb%(p,jy)=-1
1320 if a1>1 then 1340
1330 if a2<=1 then if a3<=1 then if a4<=1 then bd%(r,c)=2: goto 1690
1340 if a1=<3 then 1380
1350 if a2>3 then if a2<>a1 then gosub 2340
1360 if a3>3 then if a3<>a1 then gosub 2340
1370 if a4>3 then if a4<>a1 then gosub 2340
1380 if a2>3 then if a3>3 then if a3<>a2 then gosub 2340
1390 if a2>3 then if a4>3 then if a4<>a2 then gosub 2340
1400 if a3>3 then if a4>3 then if a4<>a3 then gosub 2340
1410 if a1<4 then if a2<4 then if a3<4 then if a4<4 then 1490
1420 if bd%(r,c)>3 then 1690
1430 if a1>3 then i=a1-3
1440 if a2>3 then i=a2-3
1450 if a3>3 then i=a3-3
1460 if a4>3 then i=a4-3
1470 bd%(r,c)=i+3
1480 as%(i)=as%(i)+1: sp%(i)=sp%(i)+100: goto 1540
1490 for i=1 to 5: if as%(i)=0 then 1510
1500 next i: if bd%(r,c)<3 then bd%(r,c)=2: gosub 2190: goto 1730
1510 t$="a new shipping company has been formed! "
1520 t$=t$+"it's name is "+chr$(13)+" "+nm$(i)
1530 sh%(i,p)=sh%(i,p)+5: as%(i)=1: hs=1
1540 if a1=3 then sp%(i)=sp%(i)+500
1550 if a2=3 then sp%(i)=sp%(i)+500
1560 if a3=3 then sp%(i)=sp%(i)+500
1570 if a4=3 then sp%(i)=sp%(i)+500
1580 if a1=2 then sp%(i)=sp%(i)+100: as%(i)=as%(i)+1: bd%(r-1,c)=i+3
1590 if a2=2 then sp%(i)=sp%(i)+100: as%(i)=as%(i)+1: bd%(r+1,c)=i+3
1600 if a3=2 then sp%(i)=sp%(i)+100: as%(i)=as%(i)+1: bd%(r,c+1)=i+3
1610 if a4=2 then sp%(i)=sp%(i)+100: as%(i)=as%(i)+1: bd%(r,c-1)=i+3
1620 if sp%(i)>=ps then t1=i: gosub 2970
1630 bd%(r,c)=i+3: as%(i)=as%(i)+1: gosub 2190: (NULL)
1640 if hs=1 then hs=0: gosub 3710
1650 if sp=0 then 1730
1660 print left$(cd$,23);tab(4);"[153]press fire[146] to continue.": sp=0
1670 jv=peek(56320): fb=(jv and 16): if fb then 1670
1680 (NULL)(3): goto 1730
1690 gosub 2190
1700 rem
1710 rem *** check for stock buys ***
1720 rem
1730 for i=1 to 5: cc(p)=cc(p)+int(.05*sh%(i,p)*sp%(i)): next i
1740 t=0: for i=0 to 5: t=t+as%(i): next i
1750 if t=0 then 740
1760 t$="[159]purch"+chr$(13): for i=1 to 5
1770 t$=t$+" "+ex$(i)+chr$(13)+chr$(13)
1780 next i: t$=t$+" [155]stk"+chr$(13)+chr$(13)+" end"
1790 (NULL)(4,31,18,8): (NULL)(1,13,0,32,5,5)
1800 (NULL)(1,t$): jy=1
1810 print left$(cd$,7+2*(jy-1));tab(32);jy$
1820 jv=peek(56320): fb=(jv and 16): jv=15-(jv and 15)
1830 if fb=0 then 1920
1840 if jv=1 or jv=2 then 1860
1850 goto 1820
1860 print left$(cd$,7+2*(jy-1));tab(32);bj$
1870 if jv=1 then jy=jy-1
1880 if jv=2 then jy=jy+1
1890 if jy<1 then jy=7
1900 if jy>7 then jy=1
1910 goto 1810
1920 if jy=6 then gosub 3100: goto 1810
1930 if jy=7 then: (NULL)(3): goto 740
1940 if as%(jy)=0 then: (NULL)(3): goto 1760
1950 t$="[155]how many shares of "+nm$(jy)
1960 mx=int(cc(p)/sp%(jy)): t1$=str$(mx): t1$=right$(t1$,len(t1$)-1)
1970 t$=t$+"[155] to buy? (max ="+t1$+")"+chr$(13)
1980 t$=t$+"your cash $"+str$(cc(p))+chr$(13)+"?[154]"
1990 (NULL)(16,6,7,22): (NULL)(1,5,0,32,1,1)
2000 (NULL)(1,t$)
2010 ct=0
2020 print left$(cd$,22);tab(8);ct;"[157] "
2030 jv=peek(56320): fb=(jv and 16): jv=15-(jv and 15)
2040 if fb=0 then 2120
2050 if jv=1 or jv=2 then 2070
2060 goto 2030
2070 if jv=1 then ct=ct+1
2080 if jv=2 then ct=ct-1
2090 if ct<0 then ct=mx
2100 if ct>mx then ct=0
2110 goto 2020
2120 sh%(jy,p)=sh%(jy,p)+ct: cc(p)=cc(p)-(ct*sp%(jy))
2130 (NULL)(3)
2140 jv=peek(56320): fb=(jv and 16): if fb=0 then 2140
2150 goto 1810
2160 rem
2170 rem *** screen update routine ***
2180 rem
2190 if wn=3 then 2250
2200 print "[147][155]";tab(15);"trail west"
2210 (NULL)(3,3,14,29): (NULL)(1,14,0,32,5,5): wn=3
2220 t$=" map of the west "+chr$(13)
2230 t$=t$+"