home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1988 August
/
1988-08.d64
/
investor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
190 lines
10 rem copyright 1988 compute! publications, inc. - all rights reserved
20 r=53280:s=r+1:h=646
30 if peek(65530)=164 then r=65305:s=65301:h=1339
40 ifpeek(65530)=5then(NULL)15:h=241
50 t=11:m1=1000:m2=1000:ti$="000000":x=rnd(-ti)
60 poker,0:pokes,0:pokeh,3:print"[147]"
70 printtab(15)"investor":printtab(12)"copyright 1988"
80 printtab(7)"compute! publications, inc."
90 printtab(10)"all rights reserved":fortt=1 to 2000:next
100 print"[147]"tab(5)"number of players (1 or 2)? ";
110 geta$:ifval(a$)< 1 or val(a$)>2 then 110
120 printa$:for d=1 to 750:next
130 for p=1 to val(a$)
140 print"[147]"tab(9)"player"p"name ";
150 inputp$(p):p$(p)=left$(p$(p),7):ifp$(p)=""then150
160 next
170 print"[147]"tab(6)"enter time limit: s[146]hort"
180 printtab(24)"m[146]edium"
190 printtab(24)"l[146]ong":printtab(15);
200 get t$:ift$=""then200
210 ift$="s"then tm=3000:goto250
220 ift$="m"then tm=5500:goto250
230 ift$="l"then tm=8000:goto250
240 goto200
250 forx=bto100:next
260 print"[147][159]":print"[207]";:forx=0to36:print"[183]";:next:print"[208]"
270 print"":forb=0to20:print"[180]":next
280 print"[204]";:forb=0to36:print"[175]";:next:print"[186][157][145]";:forb=0to20:print"[170][157][145]";
290 next:iffl=1then310
300 dims$(11),col(11):forx=1to11:reads$(x):next:forx=1to11:readcol(x):next
310 print"[158] funds ":print"[159] "
320 forx=1to11
330 pokeh,col(x):print""s$(x):next
340 if tm<0 then tm=0
350 print"[159]";:printtab(16)""tm"[146]"
360 print"[158]";:printtab(13)"cost at hi low div"
370 forx=1to11
380 print"";:next
390 print"[158]"tab(4)" cash reserves [146]"
400 ifval(a$)=1thenprint""p$(1)"[146]":goto420
410 print""p$(1):print""p$(2)"[146]"
420 print"":iffl=1then480
430 dima(t),b(t),c(t),cc(t),d(t),j(t),p1(t),p2(t)
440 fort=1to11
450 a(t)=100:b(t)=0:c(t)=100:cc(t)=100:d(t)=0:p1(t)=0:p2(t)=0
460 print"[159]"tab(13)a(t)""b(t)c(t)cc(t):next
470 fl=1
480 print"";:forb=1to18:print"";:next:forb=1to12:printtab(12)"$"m1
490 ifval(a$)=2 then print""tab(12)"$"m2
500 rem *main routine*
510 x=int(rnd(1)*12)
520 if x=0 then 510
530 y=int(rnd(1)*6)
540 ify=0then530
550 print"[159]":z=x+2
560 forq=1toz:print"";:next
570 si=int(rnd(1)*4):if si=0 or si=2thensi=-1:goto590
580 si=1
590 j(x)=a(x):k=c(x):a(x)=a(x)+y*si:b(x)=b(x)+y*si:d(x)=y
600 print"[159]"tab(13);:ifa(x)<=0ora(x)>=200thenb(x)=0:c(x)=100:cc(x)=100
610 ifa(x)<=0 then p1(x)=0:p2(x)=0:a(x)=100:d$="brk ":goto630
620 ifa(x)>=200 then p1(x)=p1(x)*2:p2(x)=p2(x)*2:a(x)=100:d$="spl "
630 ifa(x)<100 then print" ";
640 ifa(x)<10 then print" ";
650 printa(x)" [157][157][157][157]";
660 ifb(x)<0 then pokeh,2:goto680
670 goto710
680 ifb(x)>=-9 then print" ";:goto730
690 ifb(x)>=-99 then print" ";:goto730
700 goto730
710 ifb(x)<10 then print" ";:goto730
720 ifb(x)<100 then print" ";
730 printb(x);
740 ifa(x)>c(x) then c(x)=a(x)
750 pokeh,3:printc(x);
760 ifa(x)<cc(x) then cc(x)=a(x)
770 ifcc(x)<10 then print" ";:goto800
780 ifcc(x)=100 then 800
790 print" ";
800 printcc(x);
810 ifb(x)<0 then pr=.005*a(x):goto850
820 pr=int(y*.01*a(x))
821 if d$="spl " then print"";d$;:d$="":for b=1 to 500:next:goto840
822 if d$="brk " then print"";d$;:d$="":for b=1 to 500:next:goto840
830 print"%"d(x);:forb=1to200:next
840 print"[157][157][157][157] "
850 ifp1(x)>0 then m1=m1+int(pr*p1(x))
860 ifp2(x)>0 then m2=m2+int(pr*p2(x))
870 print"";:forb=1to18:print"";:next:forb=1to12:printtab(12)"$"m1
880 ifval(a$)=2thenprint""tab(12)"$"m2
890 geti$:ifi$=" "then930
900 gosub1570:print""tab(16)"[159]"tm"[146][157] "
910 iftm=0then1610
920 goto510
930 input"[147][159]enter name of player ";v$:v$=left$(v$,7)
940 ifv$=p$(1) then pl=1:mo=m1:goto980
950 ifv$=p$(2) then pl=2:mo=m2:goto980
960 print""v$"[146] is not a player."
970 for pa=1to1000:next:goto930
980 print"[147][159]":print"[207]";:forx=0to36:print"[183]";:next:print"[208]"
990 print"":forx=0 to 12:print"[180]":next
1000 print"[204]";:forx=0 to 36:print"[175]";:next:print"[186][157][145]";:forx=0 to 12:print"[170][157][145]";
1010 next:print""tab(12)v$"[146] $"mo
1020 print"[158] funds qty value [146]"
1030 foru=1 to 11
1040 pokeh,col(u):print""s$(u):next
1050 print""
1060 ifpl=2then1130
1070 x$="[157][157][157][157][157]":forx=1to11
1080 print"[159]"tab(19);
1090 print left$(x$,len(str$(p1(x)))-2)p1(x);
1100 ifa(x)<10 then print" ";:goto1120
1110 ifa(x)<100 then print" ";
1120 printtab(30)a(x):next:goto1200
1130 forx=1to11
1140 x$="[157][157][157][157][157]":forx=1to11
1150 print"[159]"tab(19);
1160 printleft$(x$,len(str$(p2(x)))-2)p2(x);
1170 ifa(x)<100 then print" ";:goto1190
1180 ifa(x)<10 then print" ";
1190 printtab(30);a(x):next
1200 print"do you wish to b[146]uy or s[146]ell?";
1210 gett$:ift$="" then 1210
1220 ift$="s"ort$="b" then 1250
1230 ift$=" "then tm=tm-30:goto260
1240 goto 1210
1250 print:print"[145] "
1260 input"[145]enter fund";st$
1270 for x=1 to 11:ifst$=s$(x)then1330
1280 next
1290 print""st$" is not a fund."
1300 forb=1to1000:next:print"[145][145]"
1310 forb=1to2:print" ":next
1320 print"[145][145]";:goto1260
1330 print"[145] "
1340 ift$="s"then1450
1350 sl=int(mo/a(x))
1360 print"you may buy a maximum of"sl
1370 input"how many do you want";am:ifam<0 then print:goto1410
1380 ifam>sl then print"you can't buy that many.":goto1400
1390 goto1420
1400 forb=1to 1000:next:print"[145] "
1410 print"[145][145][145]";:goto1370
1420 ifpl=1 then p1(x)=p1(x)+am:m1=m1-int(am*a(x)):goto940
1430 p2(x)=p2(x)+am:m2=m2-int(am*a(x))
1440 goto 940
1450 input"how many to sell";sl$
1460 ifpl=1 then am=p1(x):goto1480
1470 am=p2(x)
1480 sl=val(sl$):ifsl<0 then print:goto1510
1490 ifsl>am then print"you don't have that many.":goto1510
1500 goto 1540
1510 forb=1to1000:next:print"[145][145]";
1520 forb=1to2:print" ":next
1530 print"[145][145]";:goto1450
1540 ifpl=1 then m1=m1+sl*a(x):p1(x)=p1(x)-sl:goto1560
1550 ifpl=2 then m2=m2+sl*a(x):p2(x)=p2(x)-sl
1560 goto 940
1570 tm=tm-1
1580 iftm=<0 then tm=0
1590 return
1600 rem *** end of game ***
1610 print"[147][159]";:printtab(12)"market closes "
1620 forx=1to11
1630 pa=pa+p1(x)*a(x)
1640 next
1650 print""tab(10)"final statistics"
1660 print"player cash funds net worth"
1670 print"[163][163][163][163][163][163] [163][163][163][163] [163][163][163][163][163] [163][163][163][163][163][163][163][163][163]"
1680 print""p$(1):print"[146][145]$"m1"[159]"
1690 printspc(18):print"[145]$"pa
1700 t1=pa+m1
1710 printspc(28)"[145]$"t1
1720 ifval(a$)=2thenprint""p$(2):goto1740
1730 goto 1810
1740 forx=1to11
1750 pb=pb+p2(x)*a(x)
1760 next
1770 printspc(9):print"[145][159]$"m2
1780 printspc(18)"[145]$"pb
1790 t2=pb+m2
1800 printspc(28)"[145]$"t2
1810 print""tab(11)"play again? (y/n)"
1820 geta$:ifa$="" then 1820
1830 ifa$<>"y" then end
1840 run
1850 data leisure,aerospace,gold,energy,agriculture,technology,automotive
1860 data minerals,chemicals,computers,electronics
1870 data 2,6,7,3,9,11,8,12,4,1,14