Purple Sunrise Stock Market

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Stocks

The Purple Sunrise Stock Market is a trading game for one to ten players. Each player sets the net worth that wins the game, between $10,000 and $1,000,000, and with several players each one has a secret password. Every week the menu offers stock price history, the current price list, buying and selling, the bankbook, personal records, loans and their repayment, and saving or loading the game; when everyone has had a turn a week passes, the market moves, and every fifth week dividends are paid. Price histories can be shown as bar or line charts, and a broker sometimes offers advice for a fee.

The program names no author. Its menu screens are headed “PSI- STOCK MARKET SIMULATION”. The 24 companies, from Carrot to Texas Hot Dog, are fictional.

Program Analysis

Company names are in c$(), and the whole price history is one long array p() of weeks*numstock entries, with each company’s latest price at p(choice*weeks). Holdings are in a(), indexed by (player-1)*numstock+choice. Subroutines are called through variables (GO SUB bord, GO SUB bank, GO SUB password). The market reset at 9980–9999 reads starting prices from DATA, varies them at random and then simulates every week of history, which the program warns takes five minutes; answering N keeps the saved market. The game saves itself with SAVE "STOX.B1" LINE 500, so a saved game resumes at the menu.

Notable Techniques

  • Subroutine and line numbers held in variables, so the program reads as named calls.
  • TS2068 ON ERR GO TO 9800 traps, with ON ERR RESET and ON ERR CONTINUE at 9800–9830, to survive bad input.

This copy came from a Larken disk. The disk prefixes on the game save and load (lines 5200 and 5550) were removed, so games are saved to and loaded from tape, and the program now starts at its title instead of the menu. It is shipped with the market that was saved with it. Tested in ZEsarUX.

Image Gallery

Source Code

    1 BORDER 1: PAPER 1: INK 6: CLS 
    3 PRINT AT 8,8;"WELCOME TO THE";AT 10,8;"PURPLE SUNRISE";AT 12,9;"STOCK MARKET": ON ERR GO TO 9800
    4 PRINT AT 15,9;"$    $$    $"
    6 FOR e=-1 TO 10 STEP 1: BEEP .2,25*SIN (e*PI/180*18)+1: NEXT e
    7 FOR e=1 TO 40: BEEP .02,-20-e/5: BEEP .02,e/5: BEEP .02,-e/5: BEEP .02,20+e/5: NEXT e
   10 CLS 
   15 LET password=9200
   16 ON ERR GO TO 9800
   17 PRINT AT 8,3;"Reset the market? (Y/N)";AT 10,2;"WARNING - It takes 5 minutes."
   18 LET b$=INKEY$
   19 IF b$="" THEN GO TO 18
   20 PRINT AT 10,2;"                             "
   21 RANDOMIZE 0: PRINT AT 8,3;"HOW MANY PLAYERS?  (1-10)"
   25 ON ERR GO TO 9800
   30 INPUT LINE q$
   40 IF VAL q$<1 OR VAL q$>10 THEN GO TO 21
   45 LET p=VAL q$
   50 IF p>1 THEN GO SUB password
   70 PRINT AT 8,3;"How much wins the game ? "
   75 ON ERR GO TO 9800
   80 INPUT "   $";win
   81 IF win>=10000 THEN CLS 
   82 IF win<10000 THEN PRINT AT 8,3;"Too easy. Let's try $10,000": LET win=10000: PAUSE 200
   83 IF win>1000000 THEN PRINT AT 8,3;"Too much. Let's try $1000000": LET win=1000000: PAUSE 200
  140 LET weeks=15
  150 LET numstock=24
  160 LET menu=500: LET bord=9000
  170 DIM a(p*numstock)
  180 LET bank=9400
  190 DIM x(p)
  200 DIM b(p)
  205 LET z$=""
  210 FOR e=1 TO p: LET z$=z$+"1": NEXT e
  215 ON ERR GO TO 9800
  220 PAPER 6: INK 0
  230 DIM y$(p): DIM f(p): DIM o(p)
  240 LET listco=9500
  250 LET week=1
  260 LET loser=9700: LET winner=9600
  270 FOR e=1 TO p: LET y$(e)="0": NEXT e
  280 LET winerset=0
  300 DATA "CARROT","LAST GAS LTD.","U.K. GOLD","ANYBANK","SABONNE","FUNDS INC.","PARIS LTD.","SOVIET ART","YUKON ESTATES","FERMATT PRIME","MICHIGAN OIL","DESERT SKIES","TEXAS HOT DOG","PINK POLYMER","MUTANTS INC.","KITCHENS INC."
  305 DATA "INTERNATIONAL","FUTURE LTD.","RHINE WINES","BLAK MAIL CO.","OXYMORON INC.","SWISS YAK CO.","LANG AND LANG","FLOYD ASSOC."
  330 LET player=1
  350 FOR e=1 TO p: LET f(e)=1000: LET o(e)=1000: NEXT e
  400 DATA 10,12,20,22,30,33,40,44,50,55,60,66,70,77,80,88,90,99,100,110,110,121,120,132,130,143,140,154,150,165,160,176,170,187,180,198,190,209,200,220,210,231,220,242,230,253,240,264
  420 IF b$="y" OR b$="Y" THEN GO TO 9980
  450 GO SUB bank
  500 REM menu
  550 GO SUB bord
  560 IF f(player)<0 THEN GO TO loser
  570 IF f(player)>=win AND o(player)<=0 THEN GO TO winner
  600 IF p>1 THEN PRINT AT 2,10; FLASH 1;" PLAYER ";player;" "
  610 PRINT AT 4,3;"Here are your options:"
  630 PRINT AT 6,3;"{1} Review Stock History";AT 7,3;"{2} See Stock Price List";AT 8,3;"{3} Buy Stock";AT 9,3;"{4} Sell Stock"
  640 PRINT AT 10,3;"{5} Check Your Bankbook";AT 11,3;"{6} "; FLASH SGN b(player);"Check Personal Records"; FLASH 0;AT 12,3;"{7} Pay Debt / Take Loan";AT 13,3;"{8} Save The Game";AT 14,3;"{9} Load A Game"
  650 PRINT AT 15,3;("{0} Let A Week Pass") AND (p=1 OR p=player);("{0} Next Player") AND (p>1 AND player<p)
  655 PRINT AT 16,3;"{Q} Quit the game"
  660 INK 2: PLOT 0,19: DRAW 255,0: INK 0
  670 PRINT AT 20,4;"This is week number ";week
  700 PRINT AT 18,3; INVERSE 1;" Please make a selection "
  710 LET q$=INKEY$: IF q$="" THEN GO TO 710
  712 IF q$="q" OR q$="Q" THEN GO TO 7000
  715 IF q$>"9" OR q$<"0" THEN BEEP .05,0: GO TO 710
  720 BEEP .05,12
  800 GO TO 1000+500*VAL q$
 1000 REM next player / week pass
 1001 CLS 
 1004 IF z$(player)="0" THEN GO TO 1010
 1005 IF b(player)>0 THEN LET y$(player)=STR$ (VAL y$(player)+1-(1 AND VAL y$(player)>8)): LET x(player)=x(player)+1: GO SUB bord: GO SUB 4200
 1010 IF p=1 OR player=p THEN GO SUB 1040: GO TO 1300
 1015 IF z$(player+1)="0" THEN LET player=player+1: GO TO 1010
 1020 LET player=player+1
 1025 IF player>1 THEN GO SUB bank
 1030 GO TO 500
 1040 GO SUB bord: PRINT AT 10,6; FLASH 1;" A WEEK IS PASSING "
 1050 REM 
 1060 IF z$(LEN z$)="0" THEN LET z$=z$( TO LEN z$-1): LET p=p-1: GO TO 1060
 1100 LET week=week+1
 1110 FOR r=1 TO weeks-1
 1120 LET m(r)=m(r+1)
 1130 FOR s=1 TO numstock
 1140 LET p((s-1)*weeks+r)=p((s-1)*weeks+r+1)
 1150 NEXT s: NEXT r
 1200 LET new=2.5*(RND-.5): IF ABS new<.05 THEN GO TO 1200
 1210 LET new=new/2+m(weeks-1)/2
 1220 LET m(weeks)=new
 1230 LET traded=ABS (30*(new+7.5))
 1240 FOR r=1 TO numstock
 1250 LET wait=(p(r*weeks-1)/3-p(r*weeks-2)/3+((r/2+5)*(new+1.5*(RND-.5))))
 1255 LET p(r*weeks)=p(r*weeks-1)+INT (wait+.5): IF p(r*weeks)<1 THEN LET p(r*weeks)=1
 1260 NEXT r
 1290 RETURN 
 1300 BEEP .03,30
 1310 PRINT AT 10,6;"                   "
 1320 PRINT AT 2,9; BRIGHT 1;"GOOD MORNING!"
 1330 IF p>1 THEN LET player=0
 1340 INK 2: PLOT 0,19: DRAW 255,0: INK 0
 1350 PRINT AT 20,4;"This is week number ";week
 1360 PRINT AT 5,3;"During the past week, ";INT traded;AT 7,3;"million shares were traded.";AT 10,3;"The average share ";"rose" AND new>=0;"fell" AND new<0;AT 12,3;ABS INT (new*10000)/1000;" points."
 1400 PRINT AT 17,2; INVERSE 1;" Press any key to continue. "
 1420 PAUSE 0
 1430 IF INT (week/5)=week/5 THEN GO SUB 1450
 1432 CLS 
 1435 IF p=1 THEN GO SUB bank: GO TO menu
 1436 IF z$(player+1)="0" THEN LET player=player+1: GO TO 1436
 1440 LET player=player+1: GO SUB bank: GO TO menu
 1450 GO SUB bord: PRINT AT 2,3;"This week, you receive your";AT 3,3;"stock dividends.  Dividends";AT 4,3;"are posted at $1 per";AT 5,3;"share this week."
 1460 FOR e=1 TO p: LET ee=0: FOR r=1 TO numstock: LET ee=ee+a((e-1)*numstock+r): NEXT r: LET f(e)=f(e)+ee*2
 1465 IF z$(e)="0" THEN NEXT e
 1467 IF p>8 THEN NEXT e: GO TO 1490
 1470 IF p>1 AND p<9 THEN PRINT AT 7+e,3;"Player ";e;" receives: $";ee*week/5
 1475 IF p=1 THEN PRINT AT 9,3;"You receive $";ee*week/5
 1480 NEXT e
 1490 PRINT AT 17,2; INVERSE 1;" Press any key to continue. "
 1495 PAUSE 0: RETURN 
 1500 REM 
 1510 GO SUB bord
 1514 IF f(player)>10 THEN GO TO 1520
 1515 GO SUB bord: PRINT AT 5,8;" BROKER'S NOTE ";AT 8,2;"I'm sorry. You cannot afford";AT 10,2;"any of the information here.";AT 12,2;"Why not try another broker.";AT 15,10;"END OF LINE.";AT 19,3;"Press any key to go to menu": PAUSE 0: GO TO menu
 1520 PRINT AT 2,3;"Which firm will you review?"
 1530 GO SUB 9500
 1540 GO SUB bord
 1550 PRINT INVERSE 1;AT 2,1;"STOCKHOLDER'S QUARTERLY REPORT"
 1555 PRINT AT 3,8; INVERSE 1;" ";c$(choice);" "
 1560 PRINT AT 5,4;"There will be a $10";AT 6,4;"broker's fee for walking";AT 7,4;"into this office."
 1570 PRINT AT 9,3;"{1} Bar Chart  ($10)";AT 11,3;"{2} Line Graph  ($10)";AT 13,3;"{3} Numeric Report  ($20)";AT 15,3;"{4} Special Advice  ($50)";AT 17,3;"Press ""M"" to return to menu"
 1580 LET f(player)=f(player)-10
 1590 PRINT AT 20,3;" Please make a selection "
 1600 LET q$=INKEY$: IF q$="" THEN GO TO 1600
 1610 IF q$="m" OR q$="M" THEN BEEP .01,6: GO TO menu
 1620 IF q$>"4" OR q$<"1" THEN BEEP .01,0: GO TO 1600
 1630 BEEP .01,18
 1650 IF q$<"4" THEN GO TO 7750+250*VAL q$
 1700 IF f(player)<61 THEN GO TO 1515
 1710 GO SUB bord
 1720 PRINT AT 8,8; FLASH 1;" CALCULATING "
 1730 LET f(player)=f(player)-50
 1750 LET max=-1000
 1760 FOR e=1 TO numstock
 1765 LET ee=0
 1770 FOR d=1 TO weeks-1
 1780 LET ee=ee+(p(e*weeks-d+1)-p(e*weeks-d))/(d*p(e*weeks-d))
 1790 NEXT d
 1800 IF ee>max THEN LET max=ee: LET best=e
 1810 NEXT e
 1850 PRINT AT 8,8;"             "
 1900 PRINT AT 3,4;" BROKER'S INSIDE ADVICE "
 1910 PRINT AT 5,22;"Week: ";week
 1920 PRINT AT 7,2;"The economic, political and";AT 8,2;"stock-specific conditions,";AT 9,2;"seem to indicate that this";AT 10,2;"would be the perfect week to";AT 11,2;"invest in some ";c$(best)
 1930 PRINT AT 13,2;"I suggest that you move in";AT 14,2;"that direction quickly and";AT 15,2;"with all of your assets.";AT 17,12;"- The Broker"
 1940 PRINT AT 19,2;" Press any key to continue. "
 1950 PAUSE 0: LET choice=best
 1960 LET f(player)=f(player)+10
 1970 LET lines=0: GO TO 8000
 1999 STOP 
 2000 REM 
 2010 GO SUB bord
 2020 LET page=1
 2100 PRINT AT 2,3;"Page: ";page;TAB 20;"Week: ";week
 2150 FOR e=(page-1)*numstock/2+1 TO page*numstock/2
 2160 LET line=e-(page-1)*numstock/2
 2165 LET peweeks=p(e*weeks)-p(e*weeks-1)
 2170 PRINT AT line+5,2;c$(e);TAB 17;p(e*weeks);TAB 23;peweeks;TAB 28;"up" AND peweeks>0;"dn" AND peweeks<0
 2180 NEXT e
 2190 PRINT AT 4,4;" NAME ";TAB 16;"COST";TAB 22;"MOVEMENT"
 2200 PRINT AT 19,1;"Press ENTER to return to menu.";AT 20,1;"Any other key turns to page ";ABS (page-2)+1;"."
 2250 LET q$=INKEY$: IF q$="" THEN GO TO 2250
 2260 IF CODE q$=13 THEN BEEP .03,4: GO TO menu
 2270 LET page=ABS (page-2)+1: BEEP .05,18: GO SUB bord: GO TO 2100
 2280 GO TO menu
 2500 REM buy
 2550 GO SUB bord
 2560 PRINT AT 2,3;"Which firm will you buy?"
 2580 GO SUB 9500: GO SUB bord
 2600 PRINT AT 4,4;"Stock in ";c$(choice);AT 5,4;"currently costs $";p(choice*weeks);AT 6,4;"per share."
 2610 PRINT AT 8,4;"You have $";f(player);AT 9,4;"cash on hand."
 2620 PRINT AT 11,4;"You may buy up to ";AT 12,4;INT (f(player)/p(choice*weeks));" shares."
 2630 PRINT AT 15,4;"How many will you buy?"
 2640 INPUT j: IF j<0 OR j>INT (f(player)/p(choice*weeks)) THEN GO TO 2640
 2650 LET j=INT j
 2700 LET f(player)=f(player)-j*p(weeks*choice)
 2720 LET a((player-1)*numstock+choice)=a((player-1)*numstock+choice)+j
 2740 GO TO menu
 3000 REM sell
 3005 GO SUB bord
 3010 LET ee=0: FOR e=1 TO numstock: IF a((player-1)*numstock+e)>0 THEN LET ee=ee+1: LET choice=e
 3015 NEXT e
 3017 IF ee=0 THEN PRINT AT 8,6;"You own no stock";AT 12,6;"Press any key...": PAUSE 0: GO TO menu
 3020 IF ee=1 THEN GO TO 3100
 3050 GO SUB 3520
 3055 LET ee=0: LET ff=4
 3060 PRINT AT 2,3;"Which firm will you sell?"
 3062 FOR e=1 TO numstock
 3064 IF a((player-1)*numstock+e)>0 THEN PRINT AT ff,2+ee*16;c$(e): LET ee=ee+1
 3065 IF ee=2 THEN LET ff=ff+1: LET ee=0
 3068 NEXT e
 3070 GO SUB 9520: GO SUB bord
 3100 PRINT AT 4,4;"You own ";a((player-1)*numstock+choice);" shares of";AT 6,7;c$(choice)
 3120 PRINT AT 9,4;"They currently sell for";AT 11,4;"$";p(weeks*choice);" per share."
 3140 PRINT AT 14,4;"Total value: $";a((player-1)*numstock+choice)*p(weeks*choice)
 3160 PRINT AT 18,4;"How many will you sell?"
 3200 INPUT j: IF j<0 OR j>a((player-1)*numstock+choice) THEN GO TO 3200
 3220 LET j=INT j
 3260 LET f(player)=f(player)+p(weeks*choice)*j
 3270 LET a((player-1)*numstock+choice)=a((player-1)*numstock+choice)-j
 3280 GO TO menu
 3499 STOP 
 3500 REM bankbook
 3510 GO SUB bord
 3515 GO SUB 3520
 3516 GO TO 3530
 3520 IF p=1 THEN RETURN 
 3521 PRINT AT 8,3;"Please enter your password:"
 3522 INPUT LINE q$: LET q$=q$+"     ": LET q$=q$( TO 5): IF q$<>p$(player) THEN GO TO menu
 3524 PRINT AT 8,3;"                           "
 3526 RETURN 
 3530 LET ee=0
 3550 FOR e=1 TO numstock: LET ee=ee+a((player-1)*numstock+e)*p(weeks*e): NEXT e
 3560 PRINT AT 3,9; INVERSE 1;" PLAYER ";player;" "
 3570 PRINT AT 5,3;" ASSETS: ";AT 6,3;"You have $";f(player);AT 7,3;"in the bank."
 3580 PRINT AT 9,3;" DEBITS: ";AT 10,3;"You still owe $";o(player);AT 11,3;"to your creditor."
 3590 PRINT AT 13,3;" CREDITS: ";AT 14,3;"The net worth of your";AT 15,3;"stock is $";ee
 3600 PRINT AT 18,2;"Press any key to go to menu."
 3610 PAUSE 0: GO TO menu
 4000 REM personal records
 4005 LET ee=0
 4010 GO SUB bord: GO SUB 3520
 4020 IF b(player) THEN GO SUB 4200: GO SUB bord
 4100 FOR e=1 TO numstock
 4110 IF a((player-1)*numstock+e)=0 THEN NEXT e: GO TO 4150
 4115 LET ee=ee+1
 4120 PRINT AT 5,4;"You own ";a((player-1)*numstock+e);" shares of     ";AT 7,8;c$(e);"        ";AT 10,9;"Worth $";a((player-1)*numstock+e)*p(e*weeks);"     "
 4130 PRINT AT 13,3;"Press any key to continue."
 4135 PAUSE 0
 4140 NEXT e
 4150 IF ee=0 THEN PRINT AT 8,5;"You own no stock."
 4155 PRINT AT 13,3; FLASH 1;"   DONE - Press any key.  "
 4160 PAUSE 0
 4190 GO TO menu
 4200 REM 
 4250 GO SUB 4280+b(player)*20: LET b(player)=0: RETURN 
 4300 LET x(player)=1: PRINT AT 6,3;"Unfortunately, you seem to";AT 7,3;"have ignored the messages";AT 8,3;"from your local bank too";AT 9,3;"often.  This will cost you";AT 12,9;"$";x(player)*10;AT 15,3;" AND DON'T DO IT AGAIN! ";AT 18,3;"Press any key to continue.": PAUSE 0: RETURN 
 4320 LET ee=200
 4325 PRINT AT 3,8;" PROFIT TAXES ";AT 6,3;"This quarter, the taxes on";AT 7,3;"your profits amount to";AT 10,8;"$200"
 4330 LET o(player)=o(player)+200: PRINT AT 12,3;"This sum will be added to";AT 13,3;"your debits record and";AT 14,3;"will remain there until you";AT 15,3;"PAY A DEBT or get audited";AT 17,3;"- CERTAIN TO BE TOO SOON!"
 4335 PRINT AT 19,3;"Press any key to continue.": PAUSE 0: RETURN 
 4340 PRINT AT 3,6;" LOAN COLLECTION ";AT 5,3;"The bank is reluctant but";AT 6,3;"willing to roll over your";AT 7,3;"loan.  I do suggest that";AT 8,3;"you begin to pay it.";AT 10,3;"By the way, the interest";AT 11,3;"has been been added by";AT 12,3;"computer.  $";
 4343 PRINT INT (o(player)/10)
 4345 LET o(player)=o(player)+INT (o(player)/10)
 4350 PRINT AT 15,3;"Press any key to continue.": PAUSE 0: RETURN 
 4360 PRINT AT 3,6;" TAX AUDIT "
 4365 PRINT AT 6,3;"The bank seems to have made";AT 7,3;"an error in your favour.";AT 9,3;"You receive $";INT (f(player)/25)+50
 4370 LET f(player)=f(player)+INT (f(player)/25)+50: PRINT AT 12,3;"Spend it wisely!";AT 16,3;"Press any key to continue.": PAUSE 0: RETURN 
 4380 PRINT AT 4,4;" FEDERAL GRANT    $500";AT 7,3;"For some crazy reason,";AT 8,3;"the government has taken a";AT 9,3;"passive interest in your";AT 10,3;"progress and has decided";AT 11,3;"to throw a little money";AT 12,3;"into your ""research"" of the";AT 13,3;"stock market."
 4385 PRINT AT 15,3; FLASH 1;" ADVICE: "; FLASH 0;"  Don't ask why!"
 4390 LET f(player)=f(player)+500
 4395 PRINT AT 18,3;"Press any key to continue.": PAUSE 0: RETURN 
 4400 PRINT AT 7,3;"HAPPY BIRTHDAY!!!";AT 9,3;"Your stock broker has given";AT 10,3;"you a present of $1,000.00 ";AT 11,3;"dollars.";AT 13,3;"   ENJOY AND HAPPY BIRTHDAY"
 4405 LET f(player)=f(player)+1000
 4406 PRINT AT 19,3;"Press any key to continue."
 4410 PAUSE 0: RETURN 
 4420 PRINT AT 4,3;"FELICITATIONS!";AT 7,6;"Your fourth cousin";AT 8,6;"- twice removed -";AT 8,6;"just passed away." 
 4425 LET j=INT (RND*24)+1
 4428 PRINT AT 11,6;"Your cousin left you";AT 12,6;"20 shares of";AT 13,6;c$(j)
 4430 PRINT AT 16,6;"Use them well.";AT 19,3;"Press any key to continue."
 4432 LET a((player-1)*numstock+j)=a((player-1)*numstock+j)+20
 4435 PAUSE 0: RETURN 
 4440 PRINT AT 5,3;" Telegram: "; INVERSE 1;y$(player);" "; INVERSE 0;TAB 18;"Week: ";week;AT 8,3;"From: BANK";AT 9,3;"To: PLAYER ";player;AT 11,3;"We strongly advise that you";AT 12,3;"begin to pay the balance";AT 13,3;"of your loan immediately!";AT 15,15;"- The Bank"
 4445 IF y$(player)<"9" THEN LET y$(player)=STR$ (VAL y$(player)+1)
 4450 PRINT AT 19,3;"Press any key to continue.": PAUSE 0: RETURN 
 4460 PRINT AT 5,3;" NOTICE OF FORECLOSURE: ";AT 7,3;"The bank has decided that";AT 8,3;"are a bad risk and you will";AT 9,3;"be asked to start the game";AT 10,3;"again."
 4465 PRINT AT 13,18;"- The Bank"
 4467 FOR e=1 TO numstock: LET a((player-1)*numstock+e)=0: NEXT e
 4470 PRINT AT 17,3;"Press any key to continue.": PAUSE 0: LET f(player)=1000: LET o(player)=1000: RETURN 
 4499 STOP 
 4500 REM loans
 4520 GO SUB bord
 4550 FOR e=1 TO numstock: LET ee=ee+a((player-1)*numstock+e)*p(weeks*e): NEXT e
 4600 PRINT AT 5,3;"If you wish to take a loan,";AT 6,3;"press ""L"".";AT 9,3;"If you wish to pay a debt,";AT 10,3;"press ""D"".";AT 13,3;"Press any other key to";AT 14,3;"return to the menu."
 4610 LET q$=INKEY$: IF q$="" THEN GO TO 4610
 4620 IF q$="D" OR q$="d" THEN GO TO 4800
 4630 IF q$<>"L" AND q$<>"l" THEN GO TO menu
 4640 IF o(player)>win/5 OR ee+f(player)<o(player)/15 THEN GO SUB 4860: GO TO menu
 4650 GO SUB bord
 4660 PRINT AT 5,3;"How much do you wish to";AT 6,3;"borrow from the bank?";AT 9,3;"(Please enter a number.)"
 4670 INPUT "Loan of $";loan
 4680 LET loan=ABS loan
 4685 IF loan>win/2 THEN GO SUB 4860: GO TO 4650
 4690 IF loan>10*f(player)+1000 THEN GO SUB 4860: GO TO 4650
 4695 IF loan+o(player)>2*win THEN GO SUB 4860: GO TO 4650
 4700 LET f(player)=f(player)+loan: LET o(player)=o(player)+loan
 4710 PRINT AT 13,7;" O.K. ": PAUSE 50: GO TO menu
 4800 GO SUB bord
 4801 IF f(player)>0 THEN GO TO 4805
 4802 PRINT AT 10,4;"You do not have any money!";AT 12,4;"Press any key to continue..."
 4803 IF INKEY$="" THEN GO TO 4803
 4804 GO TO menu
 4805 PRINT AT 5,3;"How much do you wish to";AT 6,3;"pay to the bank?";AT 9,3;"You owe $";o(player);AT 13,3;"(Please enter a number.)"
 4810 INPUT "Install $";pay
 4815 LET pay=ABS pay
 4820 IF f(player)<=pay OR o(player)<pay THEN GO SUB 4860: GO TO 4800
 4830 LET o(player)=o(player)-pay: LET f(player)=f(player)-pay
 4840 LET y=VAL (y$(player))-INT (6*pay/(o(player)+(1 AND o(player)<1)))
 4844 IF y>=0 THEN LET y$(player)=STR$ y
 4846 IF y<0 THEN LET y$(player)="0"
 4850 PRINT AT 18,7;" O.K. ": PAUSE 50: GO TO menu
 4860 PRINT AT 15,3; FLASH 1;"   TOO MUCH   "
 4865 IF INKEY$="" THEN GO TO 4865
 4870 PAUSE 100: RETURN 
 4999 STOP 
 5000 REM save
 5100 GO SUB bord
 5120 PRINT AT 4,4;"Place a tape in the";AT 5,4;"recorder.";AT 7,4;"PINK POLYMER tapes";AT 8,4;"will provide the best";AT 9,4;"results.";AT 11,4;"Then press  RECORD "
 5130 PRINT AT 15,1;"(That was a solicited message)"
 5200 SAVE "STOX.B1" LINE 500
 5300 GO TO menu
 5499 STOP 
 5500 REM load
 5520 GO SUB bord
 5540 PRINT AT 4,3;"Place a tape with the game";AT 5,3;"information saved on it";AT 6,3;"into the tape player.";AT 8,3;"Then press play...";AT 13,8; FLASH 1;" GOOD LUCK "
 5550 LOAD "STOX.B1"
 5600 STOP 
 7000 REM quit
 7010 GO SUB bord
 7120 GO SUB 3520
 7140 PRINT AT 4,3;"If you're sure you want";AT 5,3;"to quit press ""Q"" again."
 7150 BEEP 1,0
 7160 LET q$=INKEY$: IF q$="" THEN GO TO 7160
 7170 IF q$<>"q" AND q$<>"Q" THEN GO TO menu
 7175 PAUSE 0
 7180 PRINT AT 7,3;"O.K."
 7200 PRINT AT 9,3;"You left the game after ";week;AT 10,3;"weeks of play."
 7202 LET ee=0
 7205 FOR e=1 TO numstock: LET ee=ee+a((player-1)*numstock+e)*p(weeks*e): NEXT e
 7207 LET ee=ee+f(player)-o(player)
 7210 PRINT AT 12,3;"In that time, you managed";AT 13,3;"to ";"earn " AND ee>=0;"lose " AND ee<0;"$";ABS ee;"  -- ";"GOOD!" AND ee>0;"Poor" AND ee<=0
 7250 IF player=p THEN LET p=p-1: LET player=player-1: LET z$=z$( TO p): GO TO 7265
 7260 LET z$(player)="0"
 7265 IF z$="" THEN GO TO 7300
 7266 IF p=0 OR VAL z$=0 THEN GO TO 7300
 7270 PRINT AT 19,8;" PRESS ANY KEY... ": PAUSE 0
 7275 GO TO 1000
 7300 PRINT AT 19,8;" PRESS ANY KEY... ": PAUSE 0
 7305 GO SUB bord
 7310 PRINT AT 4,6;"The trick is to get";AT 5,4;"lots and lots of money"
 7320 FOR e=1 TO 50: BEEP .05,80*(.5-RND): NEXT e
 7330 PRINT AT 8,8;"*";TAB 15;"*";TAB 22;"*"
 7350 PRINT AT 10,6;"- by buying low -";AT 12,4;"- and selling high -"
 7370 DATA 20,-8,14,-8,18,0,-10,5,-20,8,-4,20,0,-10,0,-20,2,-10
 7380 RESTORE 7370
 7390 INK 2: PLOT 52,15: FOR e=1 TO 18: READ a: DRAW 7,a: BEEP 1,-10+PEEK 23678: NEXT e
 7400 INK 0
 7410 PRINT AT 21,0;"Press any key to play again....."
 7420 PAUSE 0
 7430 GO TO 1
 7499 STOP 
 7700 FOR v=1 TO 24: LET choice=v: GO SUB 8250: PAUSE 0: NEXT v
 8000 REM bar chart
 8005 LET lines=0
 8010 GO SUB bord: IF f(player)<11 THEN GO TO 1515
 8015 PRINT AT 8,9; FLASH 1;" CALCULATING "
 8020 LET f(player)=f(player)-10
 8030 LET high=120: LET wide=192
 8040 LET dwide=INT ((wide-16)/(weeks*2))
 8050 LET top=0: LET bot=100000: FOR e=1 TO weeks: LET now=choice*weeks-e+1: IF p(now)>top THEN LET top=p(now)
 8060 IF p(now)<bot THEN LET bot=p(now)
 8070 NEXT e
 8080 LET dhigh=((top-bot)/(high-24))
 8100 FOR e=6 TO 20: PRINT PAPER 1;AT e,7;"                       ": NEXT e
 8110 PRINT AT 20,12; BRIGHT 1;" ";c$(choice)
 8120 PRINT AT 2,2;"Bar" AND lines=0;"Line" AND lines=1;" Chart for past ";weeks;" weeks."
 8125 PRINT AT 4,2; INVERSE 1;" Press any key to continue. "
 8130 DIM k$(5): FOR e=6 TO 18 STEP 3: LET k=(top-((e/3-2)*(top-bot)/4)): LET k$=STR$ k
 8135 PRINT AT e+1,1;k$: INK 7: PLOT 57,166-e*8: DRAW 182,0: INK 0: NEXT e
 8137 IF lines=1 THEN GO TO 8300
 8145 INK 7
 8150 FOR e=1 TO weeks
 8155 LET val=p((choice-1)*weeks+e): LET stop=(val-bot)/dhigh
 8160 FOR r=1 TO dwide: PLOT 65+r+(e*2*dwide),17: DRAW 0,stop+4: NEXT r
 8165 BEEP .005,(stop-30)/4
 8170 NEXT e
 8175 INK 1
 8200 PAUSE 0: GO TO menu
 8250 REM line chart
 8260 LET lines=1
 8290 GO TO 8010
 8300 LET val=p((choice-1)*weeks+1): LET newstop=(val-bot)/dhigh
 8310 INK 7
 8320 PLOT 66+2*dwide,newstop+21
 8350 FOR e=2 TO weeks
 8360 LET val=p((choice-1)*weeks+e): LET oldstop=newstop
 8365 LET newstop=(val-bot)/dhigh
 8370 DRAW 2*dwide,newstop-oldstop
 8380 BEEP .005,(newstop-30)/4
 8390 NEXT e
 8395 INK 0
 8400 PAUSE 0: GO TO menu
 8500 REM 
 8510 GO SUB bord
 8520 IF f(player)<26 THEN GO TO 1515
 8530 LET f(player)=f(player)-25
 8540 PRINT AT 2,2;"NUMERIC REPORT: ";c$(choice)
 8550 PRINT AT 4,2;"WEEK";TAB 8;"PRICE";TAB 15;"MOVED";TAB 22;"CHANGE"
 8600 FOR e=0 TO weeks-1
 8610 LET ee=0: IF e<weeks-1 THEN LET ee=p(choice*weeks-e)-p(choice*weeks-e-1)
 8620 PRINT AT e+5,2;week-e;"*" AND week-e<1;TAB 9;p(choice*weeks-e);TAB 15;ee AND e<weeks-1;TAB 19;"up" AND ee>0;"dn" AND ee<0;TAB 23;ABS INT (ee/p(choice*weeks-e)*10000)/100;"%"
 8630 NEXT e
 8640 PRINT AT 21,0;"   PRESS ANY KEY TO CONTINUE.   "
 8650 PAUSE 0: GO TO menu
 8999 STOP 
 9000 REM 
 9001 PAPER 6: INK 0: BORDER 1
 9003 CLS 
 9005 INK 2
 9010 FOR e=0 TO 4
 9020 PLOT 0+e,0+e: DRAW 255-2*e,0: DRAW 0,167-2*e: DRAW -255+2*e,0: DRAW 0,-167+2*e
 9025 PRINT AT 0,0; PAPER 1; INK 6;"  PSI- STOCK MARKET SIMULATION  "
 9030 NEXT e
 9035 PAPER 6: INK 0: BORDER 1
 9040 RETURN 
 9100 REM 
 9200 REM password
 9220 DIM p$(p,5)
 9230 PRINT AT 8,3;"I need a secret password       ";TAB 3;"from each player:"
 9250 FOR e=1 TO p: PRINT AT 12,8; FLASH 1;"PLAYER ";e: INPUT LINE s$: LET s$=s$+"     ": LET p$(e)=s$(1 TO 5): BEEP .1,10: NEXT e
 9260 CLS : RETURN 
 9400 REM bank
 9402 LET bank=0
 9405 LET ee=0: FOR e=1 TO numstock: LET ee=ee+a((player-1)*numstock+e)*p(weeks*e): BEEP .02,e: NEXT e: LET ee=ee+f(player)-o(player)
 9407 IF o(player)>10*(o(player)+ee) THEN LET bank=8
 9410 IF x(player)>5 THEN LET bank=1
 9415 IF INT ((week+player)/7)=(week+player)/7 AND ee>0 THEN LET bank=2
 9420 IF INT ((week+player)/13)=(week+player)/13 AND o(player)>=10 THEN LET bank=3
 9425 IF INT ((week+player)/20)=(week+player)/20 AND f(player)>=10 THEN LET bank=4
 9430 IF RND>.98 THEN LET bank=5
 9435 IF RND>.98 AND ee-f(player)+o(player)>0 THEN LET bank=6
 9440 IF RND>.98 THEN LET bank=7
 9450 IF o(player)>15*(o(player)+ee) AND y$(player)>="6" THEN LET bank=9
 9455 REM used the wrong variable
 9460 LET b(player)=bank: LET bank=9400
 9499 RETURN 
 9500 REM LISTCO
 9510 FOR e=1 TO numstock/2: PRINT AT 3+e,2;c$(e)," ";c$(e+numstock/2): NEXT e
 9520 PRINT AT 17,3; INVERSE 1;" Please make a selection "
 9525 PRINT AT 19,1;"Type the first three letters";AT 20,1;"of your choice and press ENTER"
 9527 FLASH 0
 9530 INPUT LINE q$
 9532 IF q$="" THEN GO TO menu
 9535 FOR e=1 TO LEN q$: IF CODE q$(e)>96 THEN LET q$(e)=CHR$ (CODE q$(e)-32)
 9536 NEXT e
 9540 FOR e=1 TO numstock: IF c$(e,1 TO LEN q$)<>q$ THEN NEXT e: FLASH 1: GO TO 9525
 9550 LET choice=e
 9560 RETURN 
 9600 REM winner
 9605 PAPER 1: INK 7: BORDER 1
 9608 IF winerset THEN CLS : GO TO 9620
 9610 CLS : PRINT AT 1,4;"PLAYER ";player;" IS THE WINNER!"
 9615 FOR e=7 TO 1 STEP -1: BORDER e: BEEP .5,15*COS e+15: NEXT e
 9620 PRINT AT 4,1;"You have accumulated more than";AT 5,1;"$";win;" in exactly ";week;" weeks"
 9625 PRINT AT 7,4;"Thus, you are a winner !";AT 9,6; FLASH 1;" CONGRATULATIONS ! !"
 9628 PAUSE 100: PRINT : PRINT 
 9630 FOR e=1 TO p: LET ee=0: FOR f=1 TO numstock: LET ee=ee+(a((e-1)*numstock+f)*p(f*weeks)): NEXT f: PRINT "Total for player ";e;" : $";ee+f(e)-o(e): NEXT e
 9635 PRINT INVERSE 1;" GOOD JOB, PLAYER ";player
 9640 PRINT "Press any key to continue..."
 9641 IF winerset THEN PAUSE 0: GO TO 1
 9642 PAUSE 0: LET winerset=1
 9643 IF p=1 THEN GO TO 1
 9644 PRINT : PRINT "To continue this game without   player ";player;", press ""c"".": PRINT "To set up a new game, press ""g""."
 9645 LET b$=INKEY$: IF b$="c" OR b$="C" THEN GO TO 9649
 9646 IF b$="G" OR b$="g" THEN GO TO 1
 9647 GO TO 9645
 9649 PAPER 6: INK 0: BORDER 1
 9650 LET z$(player)="0"
 9652 IF player=p THEN LET p=p-1: LET z$=z$( TO LEN z$-1): LET player=p
 9654 IF player<p THEN LET player=player+1: GO TO 500
 9660 GO TO 1000
 9699 STOP 
 9700 REM loser
 9710 LET z$(player)="0"
 9720 PRINT AT 3,3;"I'm afraid that you have";AT 4,3;"lost this game.  The bank";AT 5,3;"has absorbed your stock";AT 6,3;"and closed your account."
 9722 FOR e=1 TO 5: BEEP .5,10*SIN e-30: NEXT e
 9725 PRINT AT 8,3;"If you wish to play again,";AT 9,3;"you will have to use a";AT 10,3;"different name so that the";AT 11,3;"bank will not recognize you."
 9730 PRINT AT 14,2;"Press any key to continue." AND p>1;"Press any key to play again." AND p=1
 9750 PAUSE 0
 9755 IF player=p THEN LET player=player-1: LET p=p-1: LET z$=z$( TO p)
 9760 GO TO 1+(999 AND p>0)
 9799 STOP 
 9800 ON ERR RESET 
 9810 PAUSE 100
 9820 ON ERR GO TO 9800
 9830 ON ERR CONTINUE 
 9980 REM  DO THIS ONLY TO RESET 
 9981 ON ERR GO TO 9800
 9985 BORDER 1: PAPER 1: INK 6: CLS 
 9989 LET week=-14
 9990 DIM c$(numstock,13)
 9991 DIM p(weeks*numstock)
 9992 DIM m(weeks)
 9993 PRINT AT 8,3;"Please wait  five  minutes";AT 9,3;"while I set up the market."
 9994 RESTORE 300: FOR e=1 TO numstock: READ c$(e): NEXT e
 9995 RESTORE 400
 9996 FOR r=1 TO numstock: LET adj=(RND-.5)/5: READ a: LET p(r*weeks)=a+INT (a*adj): READ a: LET p(r*weeks-1)=a+INT (a*adj): NEXT r
 9997 FOR e=1 TO weeks: GO SUB 1050: NEXT e
 9998 REM  DO THIS ONLY TO RESET 
 9999 CLS : GO TO 450

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