Stock Market Game

Date: 1983
Type: Cassette
Platform(s): TS 1000
Tags: Game

Stock Market Game is a multi-week financial simulation in which the player buys and sells shares in eight fictional companies, manages a bank loan, and tries to accumulate $50,000 debt-free before quitting. Stock prices are updated each simulated week using a pseudo-random formula that incorporates the previous week’s price movement and a random market-wide trend factor, creating momentum-like price behavior. The program stores up to six weeks of price history per stock in a three-dimensional string array L$(8,6,4), enabling both a bar-chart price graph and a tabular price-change report. A scrolling display string Z$ of 32×22 characters is pre-built at startup to serve as a reusable screen border frame. The game supports saving progress to tape and tracks a credit-rating counter CC that triggers bank foreclosure events if the player misses loan repayments.


Program Analysis

Program Structure

The program is organized into functional blocks separated by line-number ranges, with a central menu dispatch at line 580 using GOTO VAL Q$*1000 to jump to the routine for each menu option. The main sections are:

  • Lines 10–490: Initialization — arrays, company names, price history, and the screen border string Z$
  • Lines 500–580: Main menu display and input loop
  • Lines 1000–1599: Option 1 — stock history (graph and tabular report)
  • Lines 2000–2050: Option 2 — current price list
  • Lines 3010–3270: Option 3 — buy stocks
  • Lines 4010–4499: Option 4 — sell stocks
  • Lines 5010–5130: Option 5 — bank book summary
  • Lines 6010–6090: Option 6 — personal records (shareholdings)
  • Lines 7000–7270: Option 7 / Save — loan/debt payment and game save
  • Lines 8000–8280: Option 8 — pay debt or take a loan
  • Lines 9000–9530: Week-advance engine and market simulation
  • Lines 9600–9999: Shared subroutines — input, screen border, return-to-menu, quit

Market Simulation Engine

The week-advance routine begins at line 9010 (also called during initialization via GOSUB 9010 seven times at lines 430–450 to pre-populate six weeks of history before week 1). Each call generates a market-wide trend factor:

  • AA = 5*(.5-RND) — a random value in approximately (−2.5, +2.5), re-rolled if zero
  • BB = ABS(50*(AA+7.5)) — computed trading volume in millions of shares, always positive

For each of the eight stocks, the history array is shifted left (L$(R,1) through L$(R,5) take the value of the next slot), the current price is saved to L$(R,6), and a new price is computed as:

  • M = VAL P$(R) - VAL L$(R,5) — recent two-week momentum
  • P = INT(M/3 + 10*(.5-RND)*R*AA) — momentum plus a stock-specific random component scaled by stock index and market trend
  • New price clamped between 20 and 1000

This means higher-numbered stocks (e.g., stock 8, “SOVIET ART”) exhibit greater price volatility than lower-numbered ones, creating differentiated risk profiles.

Data Storage Strategy

All numeric data is stored as strings to work within the ZX81’s limited string and array facilities:

VariableTypeContents
C$(8,10)String arrayCompany names (up to 10 chars)
P$(8,4)String arrayCurrent price per share as string
A$(8,7)String arrayShares owned per company as string
L$(8,6,4)3-D string arraySix weeks of price history per stock
FNumericPlayer’s cash
ONumericOutstanding loan balance
CCNumericCredit rating counter

Values are converted with STR$ on write and VAL on read throughout. Initial prices are set by the formula STR$((R*45)+30), giving prices of 75, 120, 165, … 390 for stocks 1–8.

Screen Border Pre-computation

At lines 455–490, a 32×22-character screen image is assembled into the string Z$ using block-graphic solid characters for the top and bottom rows and a frame character pattern for the interior rows. This string is then printed in a single PRINT AT 0,0;Z$ statement (line 502) to redraw the border quickly, avoiding repeated loop-based border drawing on each screen refresh. The same Z$ is reused at the quit screen (line 9840) and the win/foreclosure screens.

Company Menu Pre-computation

Lines 462–469 build the string E$ at startup by concatenating eight formatted menu rows (each derived from a template row H$ copied from W$ and then overwritten at character positions 6–19 with the company number, separator, and name). The subroutine at line 4500 then prints E$ in a single PRINT AT 9,0;E$ to display all eight companies at once, which is more efficient than a loop of eight PRINT statements at runtime.

Menu Dispatch

Line 580 uses GOTO VAL Q$*1000 as a computed jump. Since Q$ holds a digit character “1”–”8″, multiplying by 1000 gives targets 1000, 2000, … 8000. Options “Q” and “S” are intercepted in the input subroutine at lines 9607–9608 before the numeric check, so they never reach line 580. The subroutine also enforces that only “1”–”8″ reach the dispatch (line 9610).

Price History Graph

The bar chart (lines 1200–1399) uses a horizontal bar drawn with PRINT AT x,BS;" ";xx;TAB 5;"▒▀▀▀...▀▀▀"(TO YY), where YY is the scaled bar length. The price range (min J, max H) is computed in subroutine 1080 across the current and six historical prices. The scale maps to a maximum of 20 characters (line 1305: YY=INT((Y-J)*(20/G))), clamped to 2–21.

Credit Rating and Loan System

The variable CC starts at 5 and decrements by 1 each week (line 9150). When the player makes a loan payment, CC is increased proportionally to the fraction of the debt repaid (lines 5690–5700: X=50*VAL J$/O; CC=CC+INT X). If CC drops to −1 (checked at line 5710), the bank sells the player’s stocks and adjusts the balance (subroutine at 9400). If CC goes negative before line 510 (checked at line 505: IF CC<0 THEN GOTO 5500), the weekly debt-warning branch at 5510 is entered.

Win and Loss Conditions

  • Win: Cash F >= 50000 AND debt O = 0 (lines 9200–9205) — triggers an animated congratulations screen and asks to play again
  • Bankruptcy: Cash F <= 0 (line 9300) — bank sells stocks; if still insufficient, “LOSER / ALL OUT” message and STOP
  • Foreclosure: CC = −1 or credit too low after penalty — bank seizes stocks, adjusts balance, or forecloses entirely
  • Quit: “Q” key at any menu — shows profit/loss summary and asks to confirm exit

Notable Idioms and Techniques

  • VAL "R*32+BS" at lines 480–490: using VAL of a string expression as a memory optimization for computed array indices in GO TO/GO SUB targets — here used for substring bounds
  • ("S" AND (ABS(INT(AA*4))<>BS)) at line 9160: the standard Sinclair BASIC boolean idiom for conditional string concatenation to pluralize “POINT”/”POINTS”
  • BS=1 used as a named constant throughout instead of the literal 1, making FOR loop starts and array bounds marginally more readable
  • Dividends are computed as INT(VAL A$(R)*VAL P$(R)/75) per stock per week (line 9175), giving approximately 1.33% weekly yield on holdings

Bugs and Anomalies

  • Line 1100 does not exist; line 1070 says GOTO 1100 but execution falls through to line 1105, which is the intended continuation — this works because GOTO to a non-existent line in Sinclair BASIC runs the next line numerically above the target.
  • Line 8001 does not exist; line 8280 branches to GOTO 8001, which would similarly fall through to line 8020 — likely the intended behavior to restart the loan/pay dialog.
  • Line 8000 says GOTO 9000, jumping into the week-advance routine rather than the loan menu at 8010/8020. Option 8 from the menu (“LET A WEEK PASS”) dispatches to line 8000, so this is intentional — a week passes when option 8 is chosen, consistent with the menu label.
  • Lines 7000 and 7210/7260: the save routine has two SAVE commands (lines 7210 and 7260), but line 7000 goes to 8010 (the loan routine), suggesting option 7 (“PAY DEBT/TAKE LOAN”) uses the 8010 block, while the “S” key from the input subroutine goes directly to 7200 (the save block). The label “7- PAY DEBT/TAKE LOAN” in the menu and the dispatch via GOTO VAL Q$*1000 sending “7” to line 7000 which then immediately goes to 8010 confirms this indirection.
  • At line 1402, the subroutine for the tabular price report is entered via GOTO 1400 from line 1134, but the actual code starts at 1402 — line 1400 does not exist, so execution correctly falls to 1402.
  • The CC check at line 505 uses IF CC<0 THEN GOTO 5500, but the debt-warning section at 5510 checks IF O=0 THEN GOTO 510, creating a loop back to line 510 (which does not exist) — execution falls through to 515, the week-number display, which is correct.

Content

Appears On

Related Products

Play the market, win if you accumulate $50,000. This realistic simulation lets you analyze information, buy and sell stocks, take...

Related Articles

Related Content

Image Gallery

Source Code

  10 SLOW
  20 CLS
 275 PRINT AT 8,0;"PLEASE WAIT 45 SECONDS WHILE    I COMPUTE THE CURRENT           POSITION OF THE STOCK MARKET."
 280 LET F=10000
 290 LET O=10000
 292 LET CC=5
 294 DIM A$(8,7)
 296 DIM C$(8,10)
 298 LET C$(1)="U.S.CARROT"
 300 LET C$(2)="LAST GAS"
 302 LET C$(3)="U.K.GOLD"
 304 LET C$(4)="ANYBANK"
 306 LET C$(5)="SABONNE"
 308 LET C$(6)="FUNDS INC."
 310 LET C$(7)="PARIS LTD."
 320 LET C$(8)="SOVIET ART"
 325 LET BS=1
 330 DIM P$(8,4)
 340 DIM L$(8,6,4)
 360 FOR R=BS TO 8
 370 LET A$(R)="0"
 380 LET P$(R)=STR$ ((R*45)+30)
 385 FOR K=BS TO 6
 390 LET L$(R,K)="0"
 400 NEXT K
 425 NEXT R
 430 FOR Z=BS TO 7
 440 GOSUB 9010
 450 NEXT Z
 455 DIM Z$(32*22)
 460 LET B$="████████████████████████████████"
 462 LET E$=""
 465 LET W$="█                              █"
 466 FOR T=1 TO 8
 467 LET H$=W$
 468 LET H$(6 TO 19)=STR$ T+"---"+C$(T)
 469 LET E$=E$+H$
 470 NEXT T
 474 LET Z$(BS TO 32)=B$
 475 FOR R=BS TO 20
 480 LET Z$(VAL "R*32+BS" TO VAL "R*32+32")=W$
 485 NEXT R
 490 LET Z$(VAL "21*32+BS" TO VAL "22*32")=B$
 495 CLS
 502 PRINT AT 0,0;Z$
 503 PRINT AT 0,5;"[S][T][O][X]█[-]█[A]█[S][I][M][U][L][A][T][I][O][N]"
 504 PRINT AT 21,BS;"[C][O][P][Y][R][I][G][H][T]█[(][C][)][,][1][9][8][2]█[B][Y]█[R][U][S][S][E][L][L][.]"
 505 IF CC<0 THEN GOTO 5500
 510 PRINT AT 2,BS;"THIS IS WEEK NUMBER ";Z-7
 515 PRINT AT 3,0;B$
 520 PRINT AT 5,5;"YOUR OPTIONS ARE:"
 530 PRINT AT 7,BS;"1- REVIEW STOCK HISTORY";TAB BS;"2- SEE A STOCK PRICE LIST";TAB BS;"3- BUY STOCKS";TAB BS;"4- SELL STOCKS";TAB BS;"5- CHECK YOUR BANKBOOK";TAB BS;"6- CHECK PERSONAL RECORDS";TAB BS;"7- PAY DEBT/TAKE LOAN";TAB BS;"8- LET A WEEK PASS";TAB BS;"Q- QUIT THE GAME";TAB BS;"S- SAVE THE GAME"
 540 PRINT AT 18,3;"█[Y][O][U][R]█[D][E][C][I][S][I][O][N][,]█[P][L][E][A][S][E][?]█"
 545 SLOW
 550 GOSUB 9600
 570 CLS
 580 GOTO VAL Q$*1000
 1005 GOSUB 9500
 1010 PRINT AT 5,5;"WHICH COMPANY WOULD";TAB 5;"YOU LIKE TO REVIEW?"
 1020 GOSUB 4500
 1025 GOSUB 9600
 1027 CLS
 1028 REM  FAST
 1029 PRINT AT 12,8;"CALCULATING"
 1030 REM Q$ IS CO. NAME
 1035 LET H=0
 1036 LET J=1000
 1040 LET R=VAL P$(VAL Q$)
 1042 GOSUB 1080
 1050 FOR K=BS TO 6
 1055 LET R=VAL L$(VAL Q$,7-K)
 1060 GOSUB 1080
 1065 NEXT K
 1070 GOTO 1100
 1080 IF H<R THEN LET H=R
 1085 IF J>R THEN LET J=R
 1090 IF J<20 THEN LET J=20
 1095 IF H>1000 THEN LET H=1000
 1099 RETURN
 1105 LET G=H-J
 1106 SLOW
 1108 CLS
 1110 GOSUB 9500
 1115 PRINT AT BS,BS;"STOCK: ";C$(VAL Q$)
 1120 PRINT AT 5,5;"TO SEE A PRICE GRAPH";TAB 5;"FOR THE PAST 6 WEEKS";TAB 5;"PRESS ""1"""
 1122 PRINT AT 9,5;"TO SEE A PRICE REPORT";TAB 5;"FOR THE PAST 6 WEEKS";TAB 5;"PRESS ""2"""
 1126 PRINT AT 13,5;"PRESS ""3"" TO RETURN";TAB 5;"TO THE MENU."
 1130 LET F$=INKEY$ 
 1132 IF F$="1" THEN GOTO 1200
 1134 IF F$="2" THEN GOTO 1400
 1136 IF F$="3" THEN GOTO 1150
 1139 GOTO 1130
 1150 CLS
 1160 GOTO 500
 1200 CLS
 1202 GOSUB 9500
 1204 PRINT AT BS,BS;"THIS IS WEEK NUMBER ";Z-7;TAB 0;B$
 1206 PRINT AT 4,5;"STOCK: ";C$(VAL Q$)
 1210 PRINT AT 6,BS;"WEEK"
 1215 LET YY=0
 1220 LET Y=(VAL P$(VAL Q$))
 1222 LET X=11
 1224 GOSUB 1300
 1240 FOR R=BS TO 6
 1245 LET Y=VAL L$(VAL Q$,7-R)
 1250 LET X=X-BS
 1255 GOSUB 1300
 1260 NEXT R
 1290 GOTO 1322
 1301 LET XX=Z+X-18
 1302 IF Z+X-18<0 THEN LET XX=0
 1305 LET YY=INT ((Y-J)*(20/G))
 1307 IF YY<2 THEN LET YY=2
 1308 IF YY>21 THEN LET YY=21
 1310 PRINT AT X+2,BS;" ";XX;TAB 5;"▒▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"( TO YY)
 1320 RETURN
 1322 PRINT AT 14,5;"~~▒~~~~~~~~~~▒~~~~~~~~~~▒~~~~~~~~~~▒~~"
 1325 PRINT AT 15,6;J;TAB 12;J+INT (G/3);TAB 18;H-INT (G/3);TAB 24;H;TAB 8;"PRICE PER SHARE"
 1330 IF Z+X-18<=0 THEN PRINT AT 18,BS;"WEEK=0 MEANS BEFORE GAME BEGAN"
 1340 PRINT AT 20,3;"██[H][I][T]█[A][N][Y]█[K][E][Y]█[W][H][E][N]█[R][E][A][D][Y]██"
 1350 LET J$=INKEY$ 
 1360 IF J$="" THEN GOTO 1350
 1399 GOTO 1100
 1402 LET L=0
 1405 GOSUB 9500
 1410 PRINT AT BS,BS;"THIS IS WEEK NUMBER ";Z-7
 1415 PRINT B$
 1420 PRINT AT 3,BS;"STOCK: ";C$(VAL Q$)
 1425 PRINT AT 5,2;"ACTIVITIES FOR LAST 6 WEEKS"
 1430 PRINT AT 7,BS;"WEEK";TAB 9;"PRICE";TAB 17;"CHANGE";TAB 25;"PER";TAB BS;"NUMBER";TAB 9;"PER";TAB 16;" FROM";TAB 25;"CENT";TAB 9;"SHARE";TAB 17;"LAST";TAB 25;"CHANGE";TAB 17;"WEEK"
 1432 PRINT AT 11,BS;"▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
 1435 LET X=BS
 1437 LET P=VAL P$(VAL Q$)
 1439 LET M=VAL P$(VAL Q$)-VAL L$(VAL Q$,6)
 1441 LET K=INT (100*M/P)
 1443 GOSUB 1530
 1460 FOR R=BS TO 5
 1463 LET X=X+BS
 1466 LET P=VAL L$(VAL Q$,7-R)
 1468 LET M=P-VAL L$(VAL Q$,6-R)
 1472 LET K=INT (100*M/P)
 1475 GOSUB 1530
 1480 NEXT R
 1500 GOTO 1570
 1530 LET V=Z-6-X
 1534 LET U=P
 1535 IF P<0 THEN LET U=0
 1540 IF Z-6-X<0 THEN LET V=0
 1550 PRINT AT 18-X,3;V;TAB 9;U;TAB 17;M;TAB 25;K
 1560 RETURN
 1580 IF V<=0 THEN PRINT AT 19,BS;"WEEK=0 MEANS BEFORE GAME BEGAN"
 1599 GOTO 1340
 2000 GOSUB 9500
 2005 PRINT AT 2,5;"THIS IS WEEK NUMBER ";Z-7
 2010 PRINT AT 4,2;"COMPANY";TAB 16;"PRICE";TAB 25;"PRICE";TAB 3;"NAME";TAB 17;"PER";TAB 25;"LAST";TAB 16;"SHARE";TAB 25;"WEEK"
 2015 PRINT AT 7,0;B$
 2020 FOR R=BS TO 8
 2030 PRINT AT 8+R,2;C$(R);TAB 15;"$";P$(R);TAB 24;"$";VAL L$(R,6)
 2040 NEXT R
 2050 GOTO 9700
 3010 GOSUB 9500
 3020 PRINT AT 5,5;"IN WHICH COMPANY";TAB 5;"WOULD YOU LIKE TO";TAB 5;"PURCHASE STOCK?"
 3030 GOSUB 4500
 3035 GOSUB 9600
 3040 LET Q=VAL Q$
 3050 CLS
 3060 GOSUB 9500
 3070 PRINT AT 5,5;"STOCK IN ";C$(Q);TAB 5;"COSTS ";P$(Q);" DOLLARS";TAB 5;"PER SHARE"
 3080 PRINT AT 9,5;"YOU HAVE $";F;TAB 5;"YOU MAY BUY UP TO";TAB 5;INT (F/VAL P$(Q)-BS);" SHARES."
 3100 PRINT AT 13,5;"HOW MANY SHARES";TAB 5;"WILL YOU BUY?"
 3110 PRINT AT 15,5;"(TYPE A NUMBER,";TAB 5;"THEN HIT ENTER)"
 3120 INPUT I$
 3130 CLS
 3140 PRINT AT 3,5;"DO YOU WANT ";I$;TAB 5;"SHARES OF ";C$(Q);"?";TAB 5;"(Y/N)"
 3150 LET K$=INKEY$ 
 3160 IF K$="Y" THEN GOTO 3200
 3170 IF K$="N" THEN GOTO 3050
 3180 GOTO 3150
 3200 LET U=VAL P$(Q)
 3210 IF U*VAL I$>F THEN GOTO 3050
 3211 PRINT "O.K."
 3220 LET E=VAL A$(Q)+VAL I$
 3230 LET A$(Q)=STR$ (E)
 3240 LET F=F-(U*VAL I$)
 3250 GOSUB 9200
 3260 CLS
 3270 GOTO 500
 4010 GOSUB 9500
 4015 LET DD=0
 4020 FOR R=BS TO 8
 4030 IF VAL A$(R)>0 THEN LET DD=DD+BS
 4040 NEXT R
 4050 IF DD>0 THEN GOTO 4070
 4060 PRINT AT 10,3;"YOU HAVE NO STOCK TO SELL"
 4065 PAUSE 150
 4066 CLS
 4067 GOTO 500
 4070 IF DD>BS THEN GOTO 4150
 4080 FOR R=BS TO 8
 4090 IF VAL A$(R)>0 THEN GOTO 4103
 4100 NEXT R
 4103 PRINT AT 10,3;"YOU ONLY OWN STOCK IN";TAB 3;C$(R)
 4106 FOR S=BS TO 25
 4107 NEXT S
 4110 LET Q$=STR$ (R)
 4120 GOTO 4200
 4150 PRINT AT 5,3;"WHICH OF YOUR STOCKS";TAB 3;"WOULD YOU LIKE TO SELL?"
 4155 PRINT 
 4160 FOR R=BS TO 8
 4170 IF VAL A$(R)>0 THEN PRINT TAB 5;R;"---";C$(R)
 4180 NEXT R
 4190 GOSUB 9600
 4205 LET Q=VAL Q$
 4210 CLS
 4215 GOSUB 9500
 4220 PRINT AT 3,3;"STOCK IN ";C$(Q);TAB 3;"CURRENTLY SELLS FOR";TAB 3;P$(Q);" DOLLARS PER SHARE."
 4230 PRINT AT 7,3;"YOU HAVE ";A$(Q);" SHARES"
 4240 PRINT AT 9,3;"WORTH A TOTAL OF $";VAL P$(Q)*VAL A$(Q)
 4250 PRINT AT 11,3;"HOW MANY SHARES";TAB 3;"WOULD YOU LIKE TO SELL?";TAB 3;"  ";TAB 3;"(TYPE A NUMBER,";TAB 3;"THEN HIT ENTER.)"
 4260 INPUT I$
 4270 CLS
 4280 PRINT AT 3,5;"DO YOU WANT TO SELL";TAB 5;I$;" SHARES OF ";C$(Q);"?";TAB 5;"(Y/N)"
 4290 LET K$=INKEY$ 
 4300 IF K$="N" THEN GOTO 4210
 4310 IF K$="Y" THEN GOTO 4330
 4320 GOTO 4290
 4330 IF VAL A$(Q)<VAL I$ THEN GOTO 4200
 4331 PRINT "O.K."
 4340 LET E=VAL A$(Q)
 4350 LET E=E-VAL I$
 4355 LET A$(Q)=STR$ E
 4360 LET F=F+(VAL P$(Q)*VAL I$)
 4370 GOSUB 9200
 4380 CLS
 4390 GOTO 500
 4499 STOP
 4500 REM 
 4509 PRINT AT 9,0;E$
 4510 REM  PRINT AT 9+R,5;R;"---";C$(R)
 4515 REM  NEXT R
 4530 RETURN
 5010 GOTO 5030
 5020 GOTO 9700
 5030 LET EE=0
 5032 PRINT AT 12,8;"CALCULATING"
 5035 FOR R=BS TO 8
 5040 LET EE=EE+(VAL A$(R)*VAL P$(R))
 5050 NEXT R
 5060 GOSUB 9500
 5065 PRINT AT 3,6;"YOUR TOTAL";TAB 6;"STOCK VALUE";TAB 6;"IS $";INT (EE)
 5070 GOSUB 5110
 5080 GOTO 9700
 5100 GOSUB 9500
 5110 PRINT AT 7,6;"YOU OWN";TAB 6;"$";F
 5120 PRINT AT 11,6;"YOU OWE";TAB 6;"$";O;TAB 6;"TO THE BANK"
 5130 RETURN
 5510 IF O=0 THEN GOTO 510
 5520 PRINT AT BS,BS;"THIS IS WEEK NUMBER ";Z-7
 5530 PRINT B$
 5540 PRINT AT 5,5;"THE BANK IS CONCERNED";TAB 5;"BECAUSE YOU HAVE NOT";TAB 5;"MADE YOUR LOAN PAYMENT";TAB 5;"FOR THIS MONTH."
 5550 PRINT AT 10,5;"I SUGGEST THAT YOU";TAB 5;"PAY AT LEAST $";INT (O/10+BS)
 5560 PRINT AT 13,8;"YOU HAVE $";F;TAB 8;"YOU OWE $";O
 5570 PRINT AT 16,2;"HOW MUCH WILL YOU PAY?";TAB 2;"TYPE A NUMBER";TAB 2;"THEN PRESS ENTER"
 5580 INPUT J$
 5590 IF F<VAL J$ THEN GOTO 500
 5600 IF O<VAL J$ THEN GOTO 500
 5610 CLS
 5620 PRINT AT 15,8;"DO YOU WANT TO";TAB 8;"TRANSFER $";J$;" ?";TAB 8;"(Y/N)"
 5630 LET I$=INKEY$ 
 5640 IF I$="N" THEN GOTO 500
 5650 IF I$="Y" THEN GOTO 5670
 5660 GOTO 5630
 5670 LET F=F-VAL J$
 5690 LET X=50*VAL J$/O
 5695 LET O=O-VAL J$
 5700 LET CC=CC+INT X
 5710 IF CC=-1 THEN GOTO 9400
 5720 GOSUB 9200
 5725 CLS
 5730 GOTO 500
 6010 GOSUB 9500
 6020 PRINT AT BS,BS;"THIS IS WEEK NUMBER ";Z-7
 6030 PRINT B$
 6040 PRINT AT 4,BS;"COMPANY";TAB 12;"NUMBER";TAB 23;"PRICE";TAB 2;"NAME";TAB 12;"OF SHARES";TAB 23;"THIS";TAB 12;"YOU OWN";TAB 23;"WEEK"
 6050 PRINT B$
 6060 FOR R=BS TO 8
 6070 PRINT AT 8+R,2;C$(R);TAB 15;A$(R);TAB 23;"$";P$(R)
 6080 NEXT R
 6090 GOTO 9700
 7000 GOTO 8010
 7210 SAVE "STOX"
 7220 CLS
 7230 GOTO 500
 7260 SAVE "STO[X]"
 7265 CLS
 7270 GOTO 1
 8000 GOTO 9000
 8020 GOSUB 5100
 8030 PRINT AT 16,2;"HOW MUCH WILL YOU TRANSFER?";TAB 2;"A NEGATIVE VALUE TAKES A LOAN"
 8040 PRINT TAB 2;"(TYPE A NUMBER, THEN ENTER)"
 8050 INPUT J$
 8060 CLS
 8065 IF VAL J$<0 THEN GOTO 8090
 8070 PRINT AT 10,3;"DO YOU WANT TO TRANSFER";TAB 3;"$";VAL J$;" FROM YOUR ACCOUNT";TAB 3;"TO THE BANK?  (Y/N)"
 8080 GOTO 8100
 8090 PRINT AT 3,3;"DO YOU WANT TO BORROW";TAB 3;"$";ABS VAL J$;" FROM THE BANK?";TAB 3;"(Y/N)"
 8100 LET K$=INKEY$ 
 8110 IF K$="Y" THEN GOTO 8150
 8120 IF K$="N" THEN GOTO 8010
 8130 GOTO 8100
 8150 IF F<VAL J$ THEN GOTO 8250
 8160 IF O<VAL J$ THEN GOTO 8250
 8161 PRINT "O.K."
 8170 LET F=F-VAL J$
 8175 LET X=100*VAL J$/O
 8177 IF VAL J$<0 THEN LET X=0
 8180 LET O=O-VAL J$
 8190 LET CC=CC+INT (X)
 8200 CLS
 8205 GOSUB 9200
 8210 GOTO 500
 8250 PRINT AT 20,2;"█[Y][O][U]█[P][A][I][D]█[T][O][O]█[M][U][C][H]█"
 8260 FOR R=BS TO 20
 8270 NEXT R
 8280 GOTO 8001
 9000 PRINT "A WEEK IS PASSING"
 9010 FOR R=BS TO 10
 9020 NEXT R
 9030 FAST
 9040 LET AA=5*(.5-RND)
 9044 IF AA=0 THEN GOTO 9040
 9045 LET BB=ABS (50*(AA+7.5))
 9055 FOR R=BS TO 8
 9060 FOR J=BS TO 5
 9065 LET L$(R,J)=L$(R,J+1)
 9070 NEXT J
 9075 LET L$(R,6)=P$(R)
 9077 LET M=VAL P$(R)-VAL L$(R,5)
 9080 LET P=INT (M/3+10*(.5-RND)*R*AA)
 9085 LET P=VAL P$(R)+P
 9090 IF P<20 THEN LET P=20
 9100 IF P>1000 THEN LET P=1000
 9122 LET P$(R)=STR$ (P)
 9135 NEXT R
 9136 IF Z>7 THEN GOTO 9138
 9137 RETURN
 9138 LET Z=Z+BS
 9139 CLS
 9140 SLOW
 9142 GOSUB 9500
 9145 PRINT AT BS,BS;"A WEEK HAS PASSED.";TAB 0;B$;TAB BS;"THIS IS WEEK NUMBER ";Z-7;TAB 0;B$
 9150 LET CC=CC-BS
 9155 PRINT AT 8,3;"DURING THE PAST WEEK,";TAB 3;INT (BB);" MILLION SHARES TRADED."
 9157 IF AA>0 THEN LET J$="ROSE"
 9159 IF AA<0 THEN LET J$="FELL"
 9160 PRINT AT 11,3;"THE AVERAGE STOCK ";J$;TAB 3;ABS (INT (AA*4));" POINT"+("S" AND (ABS (INT (AA*4))<>BS))
 9165 LET EE=0
 9166 LET OO=0
 9170 FOR R=BS TO 8
 9175 LET OO=INT (VAL A$(R)*VAL P$(R)/75)
 9180 LET EE=EE+OO
 9182 NEXT R
 9184 LET F=F+INT EE
 9188 PRINT AT 16,2;"YOU RECEIVED $";EE;" DIVIDENDS."
 9195 IF Z>7 THEN GOTO 9700
 9200 IF F<50000 THEN GOTO 9300
 9205 IF O>0 THEN GOTO 9300
 9210 FOR R=0 TO 21
 9215 PRINT AT R,0;B$
 9220 NEXT R
 9227 PRINT AT 10,11;"[A]█[W][I][N][N][E][R]"
 9230 FOR R=0 TO 21
 9233 PRINT AT R,0;"▚▚▚█[A]█[W][I][N][N][E][R]█▞▞▞▞▞▞█[A]█[W][I][N][N][E][R]█▚▚▚"
 9235 NEXT R
 9236 LET EE=0
 9237 FOR R=BS TO 8
 9238 LET EE=EE+(VAL P$(R)*VAL A$(R))
 9239 NEXT R
 9240 FOR R=0 TO 21
 9242 PRINT AT R,0;B$
 9244 NEXT R
 9245 PRINT AT 5,5;"[Y][O][U]█[E][A][R][N][E][D]█$";F+EE
 9246 PRINT AT 10,11;"[A]█[W][I][N][N][E][R]";TAB 8;"[C][O][N][G][R][A][T][U][L][A][T][I][O][N][S]";TAB 4;"[D][O]█[Y][O][U]█[W][A][N][T]█[A][N][O][T][H][E][R]█[G][A][M][E][?]"
 9248 PRINT AT 13,5;"[(][Y][/][N][)]"
 9260 LET J$=INKEY$ 
 9265 IF J$="Y" THEN GOTO 1
 9270 IF J$="N" THEN STOP
 9280 GOTO 9260
 9300 IF F>0 THEN RETURN
 9310 FOR R=BS TO 21
 9320 PRINT AT R-BS,0;B$
 9330 NEXT R
 9340 PRINT AT 8,4;"[Y][O][U]█[H][A][V][E]█[R][U][N]█[O][U][T]█[O][F]█[M][O][N][E][Y]";TAB 4;"[H][O][W]█[D][O]█[Y][O][U]█[E][X][P][E][C][T]";TAB 4;"[T][O]█[P][A][Y]█[Y][O][U][R]█[T][A][X][E][S]█[?][?]"
 9342 GOSUB 9430
 9345 IF F<BS THEN GOTO 9352
 9346 PRINT AT 12,4;"[T][H][E]█[B][A][N][K]█[H][A][S]█[S][O][L][D]";TAB 4;"[Y][O][U][R]█[S][T][O][C][K][S]█[A][N][D]█[H][A][S]";TAB 4;"[A][D][J][U][S][T][E][D]█[Y][O][U][R]█[B][A][L][A][N][C][E]"
 9347 CLS
 9348 FOR R=BS TO 25
 9349 NEXT R
 9350 GOTO 500
 9352 PRINT AT 13,4;"[N][O][R][M][A][L]█[F][A][L][L][-][O][U][T][.][.][.][.][L][O][S][E][R]"
 9355 FOR R=BS TO 18
 9360 NEXT R
 9370 PRINT AT 13,12;"███████████";TAB 12;"[A]██";TAB 13;"[L]██";TAB 14;"[L]██";TAB 15;"▞██";TAB 16;"[O]██";TAB 17;"[U]██";TAB 18;"[T][.][.][.][.]"
 9380 STOP
 9400 FOR R=0 TO 21
 9410 PRINT AT R,0;B$
 9420 NEXT R
 9425 PRINT AT 6,4;"[T][H][A][T]█[W][A][S]█[N][O][T]█[E][N][O][U][G][H]"
 9426 GOSUB 9430
 9428 GOTO 9455
 9430 FOR R=BS TO 8
 9435 LET F=F+(VAL P$(R)*VAL A$(R))
 9440 LET A$(R)="0"
 9450 NEXT R
 9452 RETURN
 9455 IF F<O/5 THEN GOTO 9490
 9460 LET O=O-INT (O/5)
 9465 LET F=F-INT (O/5)
 9472 PRINT AT 10,4;"[T][H][E]█[B][A][N][K]█[H][A][S]█[S][O][L][D]";TAB 4;"[Y][O][U][R]█[S][T][O][C][K][S]█[A][N][D]█[H][A][S]";TAB 4;"[A][D][J][U][S][T][E][D]█[Y][O][U][R]█[B][A][L][A][N][C][E]"
 9473 LET CC=5
 9475 FOR R=BS TO 25
 9476 NEXT R
 9480 CLS
 9485 GOTO 500
 9490 PRINT AT 8,4;"[T][H][E]█[B][A][N][K]█[H][A][S]█[D][E][C][I][D][E][D]█[T][H][A][T]";TAB 4;"[Y][O][U]█[A][R][E]█[A]█[B][A][D]█[R][I][S][K][.]";AT 14,4;"[Y][O][U]█[H][A][V][E]█[B][E][E][N]█[F][O][R][C][L][O][S][E][D]";TAB 4;"[B][Y]█[T][H][E]█[B][A][N][K][.]"
 9520 CLS
 9530 SLOW
 9540 PRINT AT 0,0;Z$
 9550 SLOW
 9580 RETURN
 9600 LET Q$=INKEY$ 
 9605 IF Q$="" THEN GOTO 9600
 9607 IF Q$="Q" THEN GOTO 9800
 9608 IF Q$="S" THEN GOTO 7200
 9610 IF Q$<"1" OR Q$>"8" THEN GOTO 9600
 9620 RETURN
 9700 PRINT AT 20,BS;"[H][I][T]█[A][N][Y]█[K][E][Y]█[T][O]█[R][E][T][U][R][N]█[T][O]█[M][E][N][U]█"
 9710 LET G$=INKEY$ 
 9720 IF G$="" THEN GOTO 9710
 9725 CLS
 9730 GOTO 500
 9800 LET EE=0
 9810 FOR R=BS TO 8
 9820 LET EE=EE+(VAL P$(R)*VAL A$(R))
 9830 NEXT R
 9835 CLS
 9840 PRINT Z$
 9850 IF F+EE-O<0 THEN PRINT AT 6,4;"YOU LOST $";O-F-EE;TAB 4;"IN ";Z-7;" WEEK"+("S" AND (Z-7)<>1)+"."
 9860 IF F+EE-O>0 THEN PRINT AT 6,4;"YOU HAVE EARNED $";F+EE-O;TAB 4;"IN ";Z-7;" WEEK"+("S" AND (Z-7)<>1)+"."
 9870 IF F+EE-O=0 THEN PRINT AT 6,4;"AFTER ";Z-7;" WEEK"+("S" AND (Z-7)<>1);TAB 4;"YOU HAVE BROKEN EVEN."
 9880 PRINT AT 12,4;"DO YOU WANT TO";TAB 4;"LEAVE THE GAME?";TAB 4;"(Y/N)"
 9890 LET Q$=INKEY$ 
 9900 IF Q$="Y" THEN GOTO 9990
 9905 IF Q$="" THEN GOTO 9890
 9910 CLS
 9920 GOTO 500
 9990 STOP
 9999 GOTO 1

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top