home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1988 August / 1988-08.d64 / investor (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  190 lines

  1. 10 rem copyright 1988 compute! publications, inc. - all rights reserved
  2. 20 r=53280:s=r+1:h=646
  3. 30 if peek(65530)=164 then r=65305:s=65301:h=1339
  4. 40 ifpeek(65530)=5then(NULL)15:h=241
  5. 50 t=11:m1=1000:m2=1000:ti$="000000":x=rnd(-ti)
  6. 60 poker,0:pokes,0:pokeh,3:print"[147]"
  7. 70 printtab(15)"investor":printtab(12)"copyright 1988"
  8. 80 printtab(7)"compute! publications, inc."
  9. 90 printtab(10)"all rights reserved":fortt=1 to 2000:next
  10. 100 print"[147]"tab(5)"number of players (1 or 2)? ";
  11. 110 geta$:ifval(a$)< 1 or val(a$)>2 then 110
  12. 120 printa$:for d=1 to 750:next
  13. 130 for p=1 to val(a$)
  14. 140 print"[147]"tab(9)"player"p"name ";
  15. 150 inputp$(p):p$(p)=left$(p$(p),7):ifp$(p)=""then150
  16. 160 next
  17. 170 print"[147]"tab(6)"enter time limit: s[146]hort"
  18. 180 printtab(24)"m[146]edium"
  19. 190 printtab(24)"l[146]ong":printtab(15);
  20. 200 get t$:ift$=""then200
  21. 210 ift$="s"then tm=3000:goto250
  22. 220 ift$="m"then tm=5500:goto250
  23. 230 ift$="l"then tm=8000:goto250
  24. 240 goto200
  25. 250 forx=bto100:next
  26. 260 print"[147][159]":print"[207]";:forx=0to36:print"[183]";:next:print"[208]"
  27. 270 print"":forb=0to20:print"[180]":next
  28. 280 print"[204]";:forb=0to36:print"[175]";:next:print"[186][157][145]";:forb=0to20:print"[170][157][145]";
  29. 290 next:iffl=1then310
  30. 300 dims$(11),col(11):forx=1to11:reads$(x):next:forx=1to11:readcol(x):next
  31. 310 print"[158] funds      ":print"[159]                                  "
  32. 320 forx=1to11
  33. 330 pokeh,col(x):print""s$(x):next
  34. 340 if tm<0 then tm=0
  35. 350 print"[159]";:printtab(16)""tm"[146]"
  36. 360 print"[158]";:printtab(13)"cost   at   hi  low  div"
  37. 370 forx=1to11
  38. 380 print"";:next
  39. 390 print"[158]"tab(4)"        cash reserves         [146]"
  40. 400 ifval(a$)=1thenprint""p$(1)"[146]":goto420
  41. 410 print""p$(1):print""p$(2)"[146]"
  42. 420 print"":iffl=1then480
  43. 430 dima(t),b(t),c(t),cc(t),d(t),j(t),p1(t),p2(t)
  44. 440 fort=1to11
  45. 450 a(t)=100:b(t)=0:c(t)=100:cc(t)=100:d(t)=0:p1(t)=0:p2(t)=0
  46. 460 print"[159]"tab(13)a(t)""b(t)c(t)cc(t):next
  47. 470 fl=1
  48. 480 print"";:forb=1to18:print"";:next:forb=1to12:printtab(12)"$"m1
  49. 490 ifval(a$)=2 then print""tab(12)"$"m2
  50. 500 rem *main routine*
  51. 510 x=int(rnd(1)*12)
  52. 520 if x=0 then 510
  53. 530 y=int(rnd(1)*6)
  54. 540 ify=0then530
  55. 550 print"[159]":z=x+2
  56. 560 forq=1toz:print"";:next
  57. 570 si=int(rnd(1)*4):if si=0 or si=2thensi=-1:goto590
  58. 580 si=1
  59. 590 j(x)=a(x):k=c(x):a(x)=a(x)+y*si:b(x)=b(x)+y*si:d(x)=y
  60. 600 print"[159]"tab(13);:ifa(x)<=0ora(x)>=200thenb(x)=0:c(x)=100:cc(x)=100
  61. 610 ifa(x)<=0 then p1(x)=0:p2(x)=0:a(x)=100:d$="brk ":goto630
  62. 620 ifa(x)>=200 then p1(x)=p1(x)*2:p2(x)=p2(x)*2:a(x)=100:d$="spl "
  63. 630 ifa(x)<100 then print" ";
  64. 640 ifa(x)<10 then print" ";
  65. 650 printa(x)"    [157][157][157][157]";
  66. 660 ifb(x)<0 then pokeh,2:goto680
  67. 670 goto710
  68. 680 ifb(x)>=-9 then print"  ";:goto730
  69. 690 ifb(x)>=-99 then print" ";:goto730
  70. 700 goto730
  71. 710 ifb(x)<10 then print"  ";:goto730
  72. 720 ifb(x)<100 then print" ";
  73. 730 printb(x);
  74. 740 ifa(x)>c(x) then c(x)=a(x)
  75. 750 pokeh,3:printc(x);
  76. 760 ifa(x)<cc(x) then cc(x)=a(x)
  77. 770 ifcc(x)<10 then print"  ";:goto800
  78. 780 ifcc(x)=100 then 800
  79. 790 print" ";
  80. 800 printcc(x);
  81. 810 ifb(x)<0 then pr=.005*a(x):goto850
  82. 820 pr=int(y*.01*a(x))
  83. 821 if d$="spl " then print"";d$;:d$="":for b=1 to 500:next:goto840
  84. 822 if d$="brk " then print"";d$;:d$="":for b=1 to 500:next:goto840
  85. 830 print"%"d(x);:forb=1to200:next
  86. 840 print"[157][157][157][157]   "
  87. 850 ifp1(x)>0 then m1=m1+int(pr*p1(x))
  88. 860 ifp2(x)>0 then m2=m2+int(pr*p2(x))
  89. 870 print"";:forb=1to18:print"";:next:forb=1to12:printtab(12)"$"m1
  90. 880 ifval(a$)=2thenprint""tab(12)"$"m2
  91. 890 geti$:ifi$=" "then930
  92. 900 gosub1570:print""tab(16)"[159]"tm"[146][157]   "
  93. 910 iftm=0then1610
  94. 920 goto510
  95. 930 input"[147][159]enter name of player ";v$:v$=left$(v$,7)
  96. 940 ifv$=p$(1) then pl=1:mo=m1:goto980
  97. 950 ifv$=p$(2) then pl=2:mo=m2:goto980
  98. 960 print""v$"[146] is not a player."
  99. 970 for pa=1to1000:next:goto930
  100. 980 print"[147][159]":print"[207]";:forx=0to36:print"[183]";:next:print"[208]"
  101. 990 print"":forx=0 to 12:print"[180]":next
  102. 1000 print"[204]";:forx=0 to 36:print"[175]";:next:print"[186][157][145]";:forx=0 to 12:print"[170][157][145]";
  103. 1010 next:print""tab(12)v$"[146]  $"mo
  104. 1020 print"[158]  funds          qty        value  [146]"
  105. 1030 foru=1 to 11
  106. 1040 pokeh,col(u):print""s$(u):next
  107. 1050 print""                     
  108. 1060 ifpl=2then1130
  109. 1070 x$="[157][157][157][157][157]":forx=1to11
  110. 1080 print"[159]"tab(19);
  111. 1090 print left$(x$,len(str$(p1(x)))-2)p1(x);
  112. 1100 ifa(x)<10 then print"  ";:goto1120
  113. 1110 ifa(x)<100 then print" ";
  114. 1120 printtab(30)a(x):next:goto1200
  115. 1130 forx=1to11
  116. 1140 x$="[157][157][157][157][157]":forx=1to11
  117. 1150 print"[159]"tab(19);
  118. 1160 printleft$(x$,len(str$(p2(x)))-2)p2(x);
  119. 1170 ifa(x)<100 then print" ";:goto1190
  120. 1180 ifa(x)<10 then print"  ";
  121. 1190 printtab(30);a(x):next
  122. 1200 print"do you wish to b[146]uy or s[146]ell?";
  123. 1210 gett$:ift$="" then 1210
  124. 1220 ift$="s"ort$="b" then 1250
  125. 1230 ift$=" "then tm=tm-30:goto260
  126. 1240 goto 1210
  127. 1250 print:print"[145]                              "
  128. 1260 input"[145]enter fund";st$
  129. 1270 for x=1 to 11:ifst$=s$(x)then1330
  130. 1280 next
  131. 1290 print""st$" is not a fund."
  132. 1300 forb=1to1000:next:print"[145][145]"
  133. 1310 forb=1to2:print"                                    ":next
  134. 1320 print"[145][145]";:goto1260
  135. 1330 print"[145]                                   "
  136. 1340 ift$="s"then1450
  137. 1350 sl=int(mo/a(x))
  138. 1360 print"you may buy a maximum of"sl
  139. 1370 input"how many do you want";am:ifam<0 then print:goto1410
  140. 1380 ifam>sl then print"you can't buy that many.":goto1400
  141. 1390 goto1420
  142. 1400 forb=1to 1000:next:print"[145]                                    "
  143. 1410 print"[145][145][145]";:goto1370
  144. 1420 ifpl=1 then p1(x)=p1(x)+am:m1=m1-int(am*a(x)):goto940
  145. 1430 p2(x)=p2(x)+am:m2=m2-int(am*a(x))
  146. 1440 goto 940
  147. 1450 input"how many to sell";sl$
  148. 1460 ifpl=1 then am=p1(x):goto1480
  149. 1470 am=p2(x)
  150. 1480 sl=val(sl$):ifsl<0 then print:goto1510
  151. 1490 ifsl>am then print"you don't have that many.":goto1510
  152. 1500 goto 1540
  153. 1510 forb=1to1000:next:print"[145][145]";
  154. 1520 forb=1to2:print"                                   ":next
  155. 1530 print"[145][145]";:goto1450
  156. 1540 ifpl=1 then m1=m1+sl*a(x):p1(x)=p1(x)-sl:goto1560
  157. 1550 ifpl=2 then m2=m2+sl*a(x):p2(x)=p2(x)-sl
  158. 1560 goto 940
  159. 1570 tm=tm-1
  160. 1580 iftm=<0 then tm=0
  161. 1590 return
  162. 1600 rem *** end of game ***
  163. 1610 print"[147][159]";:printtab(12)"market closes    "
  164. 1620 forx=1to11
  165. 1630 pa=pa+p1(x)*a(x)
  166. 1640 next
  167. 1650 print""tab(10)"final  statistics"
  168. 1660 print"player  cash     funds     net worth"
  169. 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]"
  170. 1680 print""p$(1):print"[146][145]$"m1"[159]"
  171. 1690 printspc(18):print"[145]$"pa
  172. 1700 t1=pa+m1
  173. 1710 printspc(28)"[145]$"t1
  174. 1720 ifval(a$)=2thenprint""p$(2):goto1740
  175. 1730 goto 1810
  176. 1740 forx=1to11
  177. 1750 pb=pb+p2(x)*a(x)
  178. 1760 next
  179. 1770 printspc(9):print"[145][159]$"m2
  180. 1780 printspc(18)"[145]$"pb
  181. 1790 t2=pb+m2
  182. 1800 printspc(28)"[145]$"t2
  183. 1810 print""tab(11)"play again? (y/n)"
  184. 1820 geta$:ifa$="" then 1820
  185. 1830 ifa$<>"y" then end
  186. 1840 run
  187. 1850 data leisure,aerospace,gold,energy,agriculture,technology,automotive
  188. 1860 data minerals,chemicals,computers,electronics
  189. 1870 data 2,6,7,3,9,11,8,12,4,1,14
  190.