home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene World 6
/
Scene_World_06_2003-02-15_POL__PSW_de_Side_B.d64
/
tw.game
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-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$+" a b c d e f g h i j k l"
2240 (NULL)(1,t$)
2250 print left$(cd$,5);tab(28);"[158]";mv
2260 print left$(cd$,7)
2270 for r2=1 to 9: print tab(4);"[155]";r2;: for c2=1 to 12
2280 print mid$(tk$,1+(3*(bd%(r2,c2)-1)),3);"[146] ";
2290 next c2: print: next r2
2300 (NULL): (NULL): return
2310 rem
2320 rem *** check for chain adjacent to piece played ***
2330 rem
2340 f1=a1-3: if f1<0 then f1=0
2350 f2=a2-3: if f2<0 then f2=0
2360 f3=a3-3: if f3<0 then f3=0
2370 f4=a4-3: if f4<0 then f4=0
2380 t=as%(f1): t1=f1: if as%(f2)>as%(f1) then t=as%(f2): t1=f2
2390 if as%(f3)>t then t=as%(f3): t1=f3
2400 if as%(f4)>t then t=as%(f4): t1=f4
2410 if f1=t1 or a1<4 then 2430
2420 x=f1: gosub 2530
2430 if f2=t1 or a2<4 then 2450
2440 x=f2: gosub 2530
2450 if f3=t1 or a3<4 then 2470
2460 x=f3: gosub 2530
2470 if f4=t1 or a4<4 then 2490
2480 x=f4: gosub 2530
2490 return
2500 rem
2510 rem *** announce merger ***
2520 rem
2530 t$=" [218][218][218] special announcement[146] [218][218][218]"+chr$(13)+chr$(13)
2540 t$=t$+nm$(x)+" has just been "
2550 t$=t$+"merged into "+nm$(t1)+"!"+chr$(13)
2560 t$=t$+"please note the following transactions:"+chr$(13)+chr$(13)
2570 t$=t$+" old stock = "+nm$(x)+chr$(13)
2580 t$=t$+" new stock = "+nm$(t1)+chr$(13)+chr$(13)
2590 t$=t$+" player old new total bonus[159]"+chr$(13)
2600 (NULL)(3,2,(pl+16),37): (NULL)(0,7,81,32,5,5)
2610 (NULL)(1,t$)
2620 for i=1 to pl: th=sh%(x,i)
2630 t$=left$(pn$(i)+bl$,7)+left$(bl$,4+(th>9)+(th>99)+(th>999)): th=sh%(t1,i)
2640 t$=t$+str$(sh%(x,i))+left$(bl$,4+(th>9)+(th>99)+(th>999))
2650 th=sh%(t1,i)+int((.5*sh%(x,i))+.5)
2660 t$=t$+str$(sh%(t1,i))+left$(bl$,4+(th>9)+(th>99)+(th>999))+str$(th)+" $"
2670 x1=0: for i1=1 to pl: x1=x1+sh%(x,i1): next i1
2680 th=int(10*((sh%(x,i)/x1)*sp%(x)))
2690 t$=t$+left$(bl$,5+(th>9)+(th>99)+(th>999)+(th>9999))+str$(th)
2700 (NULL)(t$): next i
2710 for i=1 to pl: sh%(t1,i)=sh%(t1,i)+int((.5*sh%(x,i))+.5)
2720 cc(i)=cc(i)+int(10*((sh%(x,i)/x1)*sp%(x))): next i
2730 for i=1 to 9: for j=1 to 12: if bd%(i,j)=x+3 then bd%(i,j)=t1+3
2740 next j,i
2750 a1=bd%(r-1,c): a2=bd%(r+1,c): a3=bd%(r,c+1): a4=bd%(r,c-1)
2760 fi=a1-3: if f1<0 then f1=0
2770 f2=a2-3: if f2<0 then f2=0
2780 as%(t1)=as%(t1)+as%(x): sp%(t1)=sp%(t1)+sp%(x)
2790 if sp%(t1)>ps then gosub 2970
2800 f3=a3-3: if f3<0 then f3=0
2810 f4=a4-3: if f4<0 then f4=0
2820 sp%(x)=100: as%(x)=0: for i=1 to pl: sh%(x,i)=0: next i
2830 if a1=2 then sp%(t1)=sp%(t1)+100: as%(t1)=as%(t1)+1: bd%(r-1,c)=t1+3
2840 if a2=2 then sp%(t1)=sp%(t1)+100: as%(t1)=as%(t1)+1: bd%(r+1,c)=t1+3
2850 if a3=2 then sp%(t1)=sp%(t1)+100: as%(t1)=as%(t1)+1: bd%(r,c+1)=t1+3
2860 if a4=2 then sp%(t1)=sp%(t1)+100: as%(t1)=as%(t1)+1: bd%(r,c-1)=t1+3
2870 if sp%(t1)>ps then gosub 2970
2880 bd%(r,c)=t1+3
2890 print left$(cd$,pl+17);tab(3);"[155]press fire[146] to continue."
2900 jv=peek(56320): fb=(jv and 16): if fb then 2900
2910 (NULL)(3): gosub 2190
2920 jv=peek(56320): fb=(jv and 16): if fb=0 then 2900
2930 return
2940 rem
2950 rem *** announce 2 for 1 stock split ***
2960 rem
2970 t$=nm$(t1)+" [158]stock"
2980 t$=t$+" has split 2: 1!"+chr$(13)+chr$(13)+"[153]press fire[146] to continue."
2990 sp%(t1)=int(sp%(t1)/2)
3000 for i1=1 to pl: sh%(t1,i1)=2*sh%(t1,i1): next i1
3010 (NULL)(14,8,6,28): (NULL)(1,15,0,32,5,5)
3020 (NULL)(1,t$)
3030 jv=peek(56320): fb=(jv and 16): if fb then 3030
3040 (NULL)(3)
3050 jv=peek(56320): fb=(jv and 16): if fb=0 then 3050
3060 return
3070 rem
3080 rem *** display individual holdings ***
3090 rem
3100 ns=0: for i3=1 to 5: if sp%(i3)>100 then ns=ns+1
3110 next i3
3120 (NULL)(10,2,(8+ns-(ns=0)),28): (NULL)(1,13,0,32,5,5)
3130 t$="stock price holdings"+chr$(13)+chr$(13)
3140 if ns=0 then t$=t$+" none"+chr$(13)
3150 for i3=1 to 5: if sp%(i3)=100 then 3180
3160 t$=t$+" "+ex$(i3)+""+left$(bl$,3+(sp%(i3)>999))+str$(sp%(i3))
3170 t$=t$+left$(bl$,6+(sh%(i3,p)>9)+(sh%(i3,p)>99))+str$(sh%(i3,p))+chr$(13)
3180 next i3
3190 t$=t$+chr$(13)+" available cash $"
3200 t1$=str$(cc(p)): t1$=right$(t1$,len(t1$)-1)
3210 t$=t$+t1$+chr$(13)+chr$(13)+"[153]press fire[146] to continue."
3220 (NULL)(1,t$)
3230 jv=peek(56320): fb=(jv and 16): if fb then 3230
3240 (NULL)(3)
3250 jv=peek(56320): fb=(jv and 16): if fb=0 then 3250
3260 return
3270 rem
3280 rem *** check for valid call game request ***
3290 rem
3300 for i3=3 to 7: bc%(i3)=0
3310 next i3
3320 for i3=1 to 9: for j3=1 to 12
3330 if bd%(i3,j3)<3 then 3350
3340 bc%(bd%(i3,j3))=bc%(bd%(i3,j3))+1
3350 next j3: next i3
3360 ns=0: for i3=3 to 7: if bc%(i3)=0 then 3380
3370 if bc%(i3)>ns then ns=bc%(i3)
3380 next i3: if ns>40 then 3780
3390 goto 930
3400 rem
3410 rem *** check to set pass flag ***
3420 rem
3430 mv%(jy)=1: kk=0: ap=0
3440 for i3=1 to 5: if mv%(i3)=1 then kk=kk+1
3450 next i3
3460 if kk=5 then ap=1
3470 goto 930
3480 rem
3490 rem *** discard player selected piece ***
3500 rem
3510 (NULL)(17,5,6,27): (NULL)(1,4,0,32,5,5)
3520 t$="which piece to discard:"+chr$(13)+chr$(13): for i=1 to 5
3530 t$=t$+str$(yb%(p,i))+" "+chr$(64+xb%(p,i))+" ": next i
3540 (NULL)(1,t$): jy=1
3550 print left$(cd$,20);tab(1+5*jy);jy$
3560 jv=peek(56320): fb=(jv and 16): jv=15-(jv and 15)
3570 if fb=0 then 3660
3580 if jv=4 or jv=8 then 3600
3590 goto 3560
3600 print left$(cd$,20);tab(1+5*jy);bj$
3610 if jv=4 then jy=jy-1
3620 if jv=8 then jy=jy+1
3630 if jy<1 then jy=5
3640 if jy>5 then jy=1
3650 goto 3550
3660 (NULL)(3): pc%(yb%(p,jy),xb%(p,jy))=0
3670 yb%(p,jy)=-1: xb%(p,jy)=-1: goto 1730
3680 rem
3690 rem *** display merger announcement ***
3700 rem
3710 (NULL)(16,3,8,32): (NULL)(0,14,90,32,20,5)
3720 t$=" [218][218][218] special announcement[146] [218][218][218]"++chr$(13)+chr$(13)+t$+chr$(13)
3730 (NULL)(1,t$)
3740 sp=1: return
3750 rem
3760 rem *** end of game standings ***
3770 rem
3780 print "[147]the game is over.": print"here are the final standings."
3790 print tab(10);"cash value";tab(22);"cash"
3800 print "player","of stock","on hand","net worth"
3810 print "[168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168][168]"
3820 for i=1 to pl: for j=1 to 5: ts(i)=ts(i)+(sp%(j)*sh%(j,i)): next j,i
3830 for i=1 to pl: print pn$(i);tab(11)"$";ts(i);tab(20);"$";cc(i);
3840 print tab(30);"$";ts(i)+cc(i): next i
3850 print "another game? ";
3860 get a$
3870 if a$="y" then print a$: clr: goto 240
3880 if a$<>"n" then 3860
3890 sys 64738
3900 rem
3910 rem *** title page ***
3920 rem
3930 print "[147]";tab(2);"[158] [146] [223][146] [169] [223][146] [146] [146]"
3940 print tab(2);" [146] [146] [146] [169][146][169] [223][223][146] [146] [146]"
3950 print tab(2);" [146] [146] [146] [169][146][169] [223][223][146] [146] [146]"
3960 print tab(2);" [146] [146][169] [146] [146] [146]"
3970 print tab(2);" [146] [146][223][223][146] [146] [146] [146] [146]"
3980 print tab(2);" [146] [146] [223][223][146] [146] [146] [146] [146]"
3990 print tab(2);" [146] [146] [223][223][146] [146] [146] [146] [146]"
4000 print tab(19);"by"
4010 print tab(12);"richard f. daley"
4020 print tab(19);"and"
4030 print tab(13);"sally j. daley"
4040 print tab(6);"[158] [146] [146] [146] [169] [223][146] [146]"
4050 print tab(6);" [146] [146] [146] [146] [146] [146]"
4060 print tab(6);" [146] [146] [146] [146] [146]"
4070 print tab(6);" [146] [169][223][146] [146] [146] [223] [223][146] [146]"
4080 print tab(6);" [146] [169][146][169][223][223][146] [146] [146] [146] [146]"
4090 print tab(6);" [169][146][169] [223][223] [146] [146] [146] [146] [146]"
4100 print tab(6);" [146][169] [223] [146] [146] [223] [146][169] [146]"
4110 return