ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

233 lines
7.0 KiB

  1. 10 PRINT TAB(30);"STOCK MARKET"
  2. 20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
  3. 30 PRINT: PRINT: PRINT
  4. 100 REM STOCK MARKET SIMULATION -STOCK-
  5. 101 REM REVISED 8/18/70 (D. PESSEL, L. BRAUN, C. LOSIK)
  6. 102 REM IMP VRBLS: A-MRKT TRND SLP; B5-BRKRGE FEE; C-TTL CSH ASSTS;
  7. 103 REM C5-TTL CSH ASSTS (TEMP); C(I)-CHNG IN STK VAL; D-TTL ASSTS;
  8. 104 REM E1,E2-LRG CHNG MISC; I-STCK #; I1,I2-STCKS W LRG CHNG;
  9. 105 REM N1,N2-LRG CHNG DAY CNTS; P5-TTL DAYS PRCHSS; P(I)-PRTFL CNTNTS;
  10. 106 REM Q9-NEW CYCL?; S4-SGN OF A; S5-TTL DYS SLS; S(I)-VALUE/SHR;
  11. 107 REM T-TTL STCK ASSTS; T5-TTL VAL OF TRNSCTNS;
  12. 108 REM W3-LRG CHNG; X1-SMLL CHNG(<$1); Z4,Z5,Z6-NYSE AVE.; Z(I)-TRNSCT
  13. 110 DIM S(5),P(5),Z(5),C(5)
  14. 112 REM SLOPE OF MARKET TREND:A (SAME FOR ALL STOCKS)
  15. 113 LET X=1
  16. 114 LET A=INT((RND(X)/10)*100+.5)/100
  17. 115 LET T5=0
  18. 116 LET X9=0
  19. 117 LET N1=0
  20. 118 LET N2=0
  21. 119 LET E1=0
  22. 120 LET E2=0
  23. 121 REM INTRODUCTION
  24. 122 PRINT "DO YOU WANT THE INSTRUCTIONS (YES-TYPE 1, NO-TYPE 0)";
  25. 123 INPUT Z9
  26. 124 PRINT
  27. 125 PRINT
  28. 126 IF Z9<1 THEN 200
  29. 130 PRINT "THIS PROGRAM PLAYS THE STOCK MARKET. YOU WILL BE GIVEN"
  30. 132 PRINT "$10,000 AND MAY BUY OR SELL STOCKS. THE STOCK PRICES WILL"
  31. 134 PRINT "BE GENERATED RANDOMLY AND THEREFORE THIS MODEL DOES NOT"
  32. 135 PRINT "REPRESENT EXACTLY WHAT HAPPENS ON THE EXCHANGE. A TABLE"
  33. 136 PRINT "OF AVAILABLE STOCKS, THEIR PRICES, AND THE NUMBER OF SHARES"
  34. 137 PRINT "IN YOUR PORTFOLIO WILL BE PRINTED. FOLLOWING THIS, THE"
  35. 138 PRINT "INITIALS OF EACH STOCK WILL BE PRINTED WITH A QUESTION"
  36. 139 PRINT "MARK. HERE YOU INDICATE A TRANSACTION. TO BUY A STOCK"
  37. 140 PRINT "TYPE +NNN, TO SELL A STOCK TYPE -NNN, WHERE NNN IS THE"
  38. 141 PRINT "NUMBER OF SHARES. A BROKERAGE FEE OF 1% WILL BE CHARGED"
  39. 142 PRINT "ON ALL TRANSACTIONS. NOTE THAT IF A STOCK'S VALUE DROPS"
  40. 143 PRINT "TO ZERO IT MAY REBOUND TO A POSITIVE VALUE AGAIN. YOU"
  41. 144 PRINT "HAVE $10,000 TO INVEST. USE INTEGERS FOR ALL YOUR INPUTS."
  42. 145 PRINT "(NOTE: TO GET A 'FEEL' FOR THE MARKET RUN FOR AT LEAST"
  43. 146 PRINT "10 DAYS)"
  44. 147 PRINT "-----GOOD LUCK!-----"
  45. 200 REM GENERATION OF STOCK TABLE; INPUT REQUESTS
  46. 210 REM INITIAL STOCK VALUES
  47. 220 LET S(1)=100
  48. 230 LET S(2)=85
  49. 240 LET S(3)=150
  50. 250 LET S(4)=140
  51. 260 LET S(5)=110
  52. 265 REM INITIAL T8 - # DAYS FOR FIRST TREND SLOPE (A)
  53. 266 LET T8=INT(4.99*RND(X)+1)
  54. 267 REM RANDOMIZE SIGN OF FIRST TREND SLOPE (A)
  55. 268 IF RND(X)>.5 THEN 270
  56. 269 LET A=-A
  57. 270 REM RANDOMIZE INITIAL VALUES
  58. 280 GOSUB 830
  59. 285 REM INITIAL PORTFOLIO CONTENTS
  60. 290 FOR I=1 TO 5
  61. 300 LET P(I)=0
  62. 305 LET Z(I)=0
  63. 310 NEXT I
  64. 320 PRINT
  65. 330 PRINT
  66. 333 REM INITIALIZE CASH ASSETS:C
  67. 335 LET C=10000
  68. 338 REM PRINT INITIAL PORTFOLIO
  69. 340 PRINT "STOCK"," ","INITIALS","PRICE/SHARE"
  70. 350 PRINT "INT. BALLISTIC MISSILES"," IBM",S(1)
  71. 352 PRINT "RED CROSS OF AMERICA"," RCA",S(2)
  72. 354 PRINT "LICHTENSTEIN, BUMRAP & JOKE"," LBJ",S(3)
  73. 356 PRINT "AMERICAN BANKRUPT CO."," ABC",S(4)
  74. 358 PRINT "CENSURED BOOKS STORE"," CBS",S(5)
  75. 360 PRINT
  76. 361 REM NYSE AVERAGE:Z5; TEMP. VALUE:Z4; NET CHANGE:Z6
  77. 363 LET Z4=Z5
  78. 364 LET Z5=0
  79. 365 LET T=0
  80. 370 FOR I=1 TO 5
  81. 375 LET Z5=Z5+S(I)
  82. 380 LET T=T+S(I)*P(I)
  83. 390 NEXT I
  84. 391 LET Z5=INT(100*(Z5/5)+.5)/100
  85. 392 LET Z6=INT((Z5-Z4)*100+.5)/100
  86. 393 REM TOTAL ASSETS:D
  87. 394 LET D=T+C
  88. 395 IF X9>0 THEN 398
  89. 396 PRINT "NEW YORK STOCK EXCHANGE AVERAGE: ";Z5
  90. 397 GOTO 399
  91. 398 PRINT "NEW YORK STOCK EXCHANGE AVERAGE: ";Z5;"NET CHANGE";Z6
  92. 399 PRINT
  93. 400 LET T=INT(100*T+.5)/100
  94. 401 PRINT "TOTAL STOCK ASSETS ARE $";T
  95. 403 LET C=INT(100*C+.5)/100
  96. 405 PRINT "TOTAL CASH ASSETS ARE $";C
  97. 407 LET D=INT(100*D+.5)/100
  98. 408 PRINT "TOTAL ASSETS ARE $";D
  99. 410 PRINT
  100. 411 IF X9=0 THEN 416
  101. 412 PRINT "DO YOU WISH TO CONTINUE (YES-TYPE 1, NO-TYPE 0)";
  102. 413 INPUT Q9
  103. 414 IF Q9<1 THEN 998
  104. 416 REM INPUT TRANSACTIONS
  105. 420 PRINT "WHAT IS YOUR TRANSACTION IN"
  106. 430 PRINT "IBM";
  107. 440 INPUT Z(1)
  108. 450 PRINT "RCA";
  109. 460 INPUT Z(2)
  110. 470 PRINT "LBJ";
  111. 480 INPUT Z(3)
  112. 490 PRINT "ABC";
  113. 500 INPUT Z(4)
  114. 510 PRINT "CBS";
  115. 520 INPUT Z(5)
  116. 525 PRINT
  117. 530 REM TOTAL DAY'S PURCHASES IN $:P5
  118. 540 LET P5=0
  119. 550 REM TOTAL DAY'S SALES IN $:S5
  120. 560 LET S5=0
  121. 570 FOR I=1 TO 5
  122. 575 LET Z(I)=INT(Z(I)+.5)
  123. 580 IF Z(I)<=0 THEN 610
  124. 590 LET P5=P5+Z(I)*S(I)
  125. 600 GOTO 620
  126. 610 LET S5=S5-Z(I)*S(I)
  127. 612 IF -Z(I)<=P(I) THEN 620
  128. 614 PRINT "YOU HAVE OVERSOLD A STOCK; TRY AGAIN."
  129. 616 GOTO 420
  130. 620 NEXT I
  131. 622 REM TOTAL VALUE OF TRANSACTIONS:T5
  132. 625 LET T5=P5+S5
  133. 630 REM BROKERAGE FEE:B5
  134. 640 LET B5=INT(.01*T5*100+.5)/100
  135. 650 REM CASH ASSETS=OLD CASH ASSETS-TOTAL PURCHASES
  136. 652 REM -BROKERAGE FEES+TOTAL SALES:C5
  137. 654 LET C5=C-P5-B5+S5
  138. 656 IF C5>=0 THEN 674
  139. 658 PRINT "YOU HAVE USED $";-C5;" MORE THAN YOU HAVE."
  140. 660 GOTO 420
  141. 674 LET C=C5
  142. 675 REM CALCULATE NEW PORTFOLIO
  143. 680 FOR I=1 TO 5
  144. 690 LET P(I)=P(I)+Z(I)
  145. 700 NEXT I
  146. 710 REM CALCULATE NEW STOCK VALUES
  147. 720 GOSUB 830
  148. 750 REM PRINT PORTFOLIO
  149. 751 REM BELL RINGING-DIFFERENT ON MANY COMPUTERS
  150. 755 PRINT
  151. 756 PRINT "********** END OF DAY'S TRADING **********"
  152. 757 PRINT
  153. 758 PRINT
  154. 759 IF X9<1 THEN 769
  155. 769 PRINT "STOCK","PRICE/SHARE","HOLDINGS", "VALUE", "NET PRICE CHANGE"
  156. 770 PRINT "IBM", S(1), P(1), S(1)*P(1), C(1)
  157. 771 PRINT "RCA", S(2), P(2), S(2)*P(2), C(2)
  158. 772 PRINT "LBJ", S(3), P(3), S(3)*P(3), C(3)
  159. 773 PRINT "ABC", S(4), P(4), S(4)*P(4), C(4)
  160. 774 PRINT "CBS", S(5), P(5), S(5)*P(5), C(5)
  161. 775 LET X9=1
  162. 780 PRINT
  163. 790 PRINT
  164. 810 GOTO 360
  165. 829 REM NEW STOCK VALUES - SUBROUTINE
  166. 830 REM RANDOMLY PRODUCE NEW STOCK VALUES BASED ON PREVIOUS
  167. 831 REM DAY'S VALUES
  168. 832 REM N1,N2 ARE RANDOM NUMBERS OF DAYS WHICH RESPECTIVELY
  169. 833 REM DETERMINE WHEN STOCK I1 WILL INCREASE 10 PTS. AND STOCK
  170. 834 REM I2 WILL DECREASE 10 PTS.
  171. 840 REM IF N1 DAYS HAVE PASSED, PICK AN I1, SET E1, DETERMINE NEW N1
  172. 841 IF N1>0 THEN 850
  173. 845 LET I1=INT(4.99*RND(X)+1)
  174. 846 LET N1=INT(4.99*RND(X)+1)
  175. 847 LET E1=1
  176. 850 REM IF N2 DAYS HAVE PASSED, PICK AN I2, SET E2, DETERMINE NEW N2
  177. 851 IF N2>0 THEN 860
  178. 855 LET I2=INT(4.99*RND(X)+1)
  179. 856 LET N2=INT(4.99*RND(X)+1)
  180. 857 LET E2=1
  181. 860 REM DEDUCT ONE DAY FROM N1 AND N2
  182. 861 LET N1=N1-1
  183. 862 LET N2=N2-1
  184. 890 REM LOOP THROUGH ALL STOCKS
  185. 900 FOR I=1 TO 5
  186. 910 LET X1=RND(X)
  187. 915 IF X1>.25 THEN 920
  188. 916 LET X1=.25
  189. 917 GOTO 935
  190. 920 IF X1>.5 THEN 925
  191. 921 LET X1=.5
  192. 922 GOTO 935
  193. 925 IF X1>.75 THEN 930
  194. 926 LET X1=.75
  195. 927 GOTO 935
  196. 930 LET X1=0.0
  197. 931 REM BIG CHANGE CONSTANT:W3 (SET TO ZERO INITIALLY)
  198. 935 LET W3=0
  199. 936 IF E1<1 THEN 945
  200. 937 IF INT(I1+.5)<>INT(I+.5) THEN 945
  201. 938 REM ADD 10 PTS. TO THIS STOCK; RESET E1
  202. 939 LET W3=10
  203. 943 LET E1=0
  204. 945 IF E2<1 THEN 955
  205. 947 IF INT(I2+.5)<>INT(I+.5) THEN 955
  206. 948 REM SUBTRACT 10 PTS. FROM THIS STOCK; RESET E2
  207. 949 LET W3=W3-10
  208. 953 LET E2=0
  209. 954 REM C(I) IS CHANGE IN STOCK VALUE
  210. 955 LET C(I)=INT(A*S(I))+X1+INT(3-6*RND(X)+.5)+W3
  211. 956 LET C(I)=INT(100*C(I)+.5)/100
  212. 957 LET S(I)=S(I)+C(I)
  213. 960 IF S(I)>0 THEN 967
  214. 964 LET C(I)=0
  215. 965 LET S(I)=0
  216. 966 GOTO 970
  217. 967 LET S(I)=INT(100*S(I)+.5)/100
  218. 970 NEXT I
  219. 972 REM AFTER T8 DAYS RANDOMLY CHANGE TREND SIGN AND SLOPE
  220. 973 LET T8=T8-1
  221. 974 IF T8<1 THEN 985
  222. 980 RETURN
  223. 985 REM RANDOMLY CHANGE TREND SIGN AND SLOPE (A), AND DURATION
  224. 986 REM OF TREND (T8)
  225. 990 LET T8=INT(4.99*RND(X)+1)
  226. 992 LET A=INT((RND(X)/10)*100+.5)/100
  227. 993 LET S4=RND(X)
  228. 994 IF S4<=.5 THEN 997
  229. 995 LET A=-A
  230. 997 RETURN
  231. 998 PRINT "HOPE YOU HAD FUN!!"
  232. 999 END