This program is a turn-based factory management simulation in which the player runs a business manufacturing and selling fictional products called “Zibbies.” Each week the player hires or fires workers, sets production targets, and faces randomized events including union pay demands, flash floods destroying stock, and supplier price increases. A sales resistance factor stored in variable `z` accumulates percentage price increases and directly influences weekly sales volume through the formula at line 4040. Starting conditions — capital, stock, sell price, manufacturing cost, workforce, wages, and productivity — are all randomized at initialization, with a guard at line 9070 ensuring the manufacturing cost never exceeds the sell price.
Program Analysis
Program Structure
The program is organized as a main loop with clearly labeled subroutines. The main loop at lines 50–180 increments the week counter and calls subroutines in sequence: status printout, workforce management, production, sales, and random events, before deducting wages and repeating.
| Line Range | Section | Purpose |
|---|---|---|
| 10–180 | Main loop | Week cycle: calls all subroutines, deducts wages |
| 3000–3390 | Unpredictables | Random events: union demands, flood, price rise, price opportunity |
| 4000–4100 | Sales | Calculates weekly sales volume and updates capital/stock |
| 5000–5120 | Printout | Status report; checks win/lose conditions |
| 5130–5300 | Make | Player sets production target; applies random shortfall |
| 6000–6100 | People | Hire and fire workers; union limits firing |
| 8000–8080 | Bankruptcy/Win | End-game handling for both outcomes |
| 9000–9500 | Variables | Randomized initialization of all game parameters |
Game Variables
capital— liquid cash on hand ($500–$999 at start)stock— units of Zibbies in warehousesellprice— retail price per Zibbiecost— manufacturing cost per Zibbie (always less thansellprice)workforce— number of employeeswage— weekly wage per employeeproduce— units one worker can make per weekz— cumulative sales resistance factor; starts at 1 and grows with each price increaseweek— current week counter
Sales Resistance Mechanic
The variable z is the simulation’s most economically interesting mechanic. It is initialized to 1 at line 9130 and incremented by each percentage price increase the player applies (line 3345: IF a>0 THEN LET z=z+a). Weekly sales volume is calculated at line 4040 as INT(RND*stock/(z/100))+1. As z grows, the divisor z/100 increases, reducing expected sales. This creates a direct trade-off between short-term revenue gain from price increases and long-term sales volume decline.
Random Event System
The unpredictables subroutine (lines 3000–3390) runs four independent probability checks each week using RND:
- Union pay demand (55% chance): raises
wageby 1–7% - Flash flood (15% chance): destroys up to half of current
stock - Supplier price rise (30% chance): increases
costby a random fraction - Price raise opportunity (35% chance, or always if
make>=sellprice): player can voluntarily raisesellprice
Each event is independent; multiple adverse events can occur in a single week.
Production Shortfall
At line 5170, actual production is reduced from the player’s target: LET make=make-INT(RND*make/5*(z/100)). This means higher sales resistance (larger z) also degrades manufacturing efficiency — an arguably unintended coupling between the pricing variable and production output. At the default z=1, the shortfall is at most 20% of target; as z grows this worsens.
Firing Mechanic
When the player chooses to fire workers, the union intervenes: line 6050 replaces the requested number with INT(RND*a+1), meaning the actual number fired is random between 1 and the requested amount. This prevents deterministic workforce reduction and adds friction to downsizing decisions.
Win and Lose Conditions
The status printout at line 5025 checks capital+stock<1 for bankruptcy (routing to line 8000) and at line 5027 checks capital+stock>999999 for the million-dollar win condition. Note that stock is measured in units, not dollar value, so this check treats units and dollars interchangeably — a minor economic inconsistency, since a large inventory at low prices could prematurely trigger bankruptcy or inflate the apparent total.
Notable Techniques and Idioms
- Currency rounding is applied consistently using the pattern
INT(100*value)/100at lines 3040, 3220, and 3350 to keep prices to two decimal places. - The BEEP calls throughout use
RND*50for pitch, producing random tones as audio feedback rather than musical notes. - The status subroutine at line 5000 is called three times per week (lines 100, 120, 140) to give the player updated information after each action phase.
- Line 4045 briefly sets a random
PAPERcolor and clears screen before restoring defaults at line 4055, creating a brief flicker effect during the sales calculation delay. - The initialization guard at line 9070 (
IF cost>sellprice THEN GO TO 9050) loops until a viable starting configuration is found, preventing an immediately unwinnable game. - The end-game restart at line 8070 uses
RUN(which re-executes from line 1) rather thanGO TO 9000, ensuring all variables are cleanly re-initialized.
Bugs and Anomalies
- Line 3110 contains a typo in the string literal:
"Stand by for damage repoty:"— “repoty” should be “report”. - At line 3290, the condition
RND<.65 AND make<sellpricecompares the production quantitymakeagainstsellprice(a price in dollars). This is a type mismatch — the intent was likely to comparecostagainstsellpriceto skip the price-raise event when there is already adequate margin. - The win condition at line 5027 uses
capital+stock(mixing currency and unit counts) rather thancapital+stock*sellprice, which would reflect actual net worth. - Line 9120 contains a comment referencing
RUN Z(REM RUN Z is sales resistance factor), which appears to be a leftover development note rather than executable code.
Content
Source Code
10 REM worksimul
40 GO SUB 9000: REM variables
50 LET week=week+1
100 GO SUB 5000: REM printout
110 GO SUB 6000: REM people
120 GO SUB 5000: REM printout
130 GO SUB 5130: REM make
140 GO SUB 5000: REM printout
150 GO SUB 4000: REM sales
160 GO SUB 3000: REM unpretictables
170 LET capital=capital-wage*workforce
180 GO TO 50
3000 REM unpredictables
3005 CLS
3010 IF RND<.45 THEN GO TO 3100
3020 LET a=INT (RND*7)+1
3025 BEEP .5,RND*50: BEEP .4,RND*50
3030 PRINT ''"Unions demand ";a;"% payraise"
3040 LET wage=INT (100*(wage+(a*wage/100)))/100
3050 PAUSE 100
3060 PRINT '''"Pay per employee is now $";wage
3070 PAUSE 100
3075 BEEP .5,RND*50: BEEP .4,RND*50
3080 CLS
3100 IF RND<.85 THEN GO TO 3190
3110 PRINT ''' INK 2; FLASH 1;"Flash flood ruins some of your"," stock",,,,"Stand by for damage repoty:",
3120 PAUSE 100
3130 LET a=INT (RND*stock/2)+1
3140 LET stock=stock-a
3150 PRINT '' INK 1; FLASH 1;"Total stock destroyed was",a;" Zibbies, worth $";a*sellprice;" retail"
3160 PAUSE 100
3170 PRINT ''"Stock on hand is now ";stock
3180 PAUSE 100
3190 IF RND>.3 THEN GO TO 3290
3195 CLS
3200 PRINT ''"Supplier announces dramatic","price rise!"
3220 LET a=INT ((RND*100*cost/7))/100
3225 IF a<.01 THEN GO TO 3220
3230 PRINT ''"Cost of making Zibbies","goes up by "; FLASH 1; INK 2;"$";a; FLASH 0; INK 0;" each"
3240 PAUSE 100
3250 LET cost=cost+a
3260 PRINT '' INK 7; PAPER 1;" It now costs "; FLASH 1; INK 7; PAPER 0;"$";cost;" "
3270 PRINT "to make each one"
3280 PAUSE 100
3290 IF RND<.65 AND make<sellprice THEN RETURN
3300 CLS
3305 BEEP .5,RND*50: BEEP .4,RND*50
3310 PRINT ''"You have a chance to raise","your price"
3320 PRINT "Zibbies now sell for $";sellprice
3330 PAUSE 100
3340 INPUT FLASH 1;"What percentage increase? ";a
3345 IF a>0 THEN LET z=z+a
3350 LET sellprice=INT (100*(sellprice+a*sellprice/100))/100
3360 PAUSE 50
3370 PRINT ' FLASH 1; INK 3;"Zibbies now sell for $";sellprice
3380 PAUSE 100
3390 RETURN
4000 REM sales
4005 BEEP .5,RND*50: BEEP .4,RND*50
4010 PRINT FLASH 1; PAPER 5;'"Total stock is ";stock
4015 PAUSE 100
4020 PRINT FLASH 1; PAPER 3;'"Stand by for sales report....."
4025 PAUSE 300
4030 CLS
4040 LET a=INT (RND*stock/(z/100))+1
4045 PAPER RND*6: CLS : BORDER RND*6
4050 IF a>stock THEN GO TO 4040
4055 BORDER 7: PAPER 7: CLS
4060 PRINT '' INK 1;"Total Zibbies sold: ";a
4070 LET stock=stock-a
4080 PRINT '"Income from sale: $";a*sellprice
4090 LET capital=capital+a*sellprice
4095 PAUSE 100
4100 RETURN
5000 REM printout
5020 FOR g=40 TO 50: BEEP .008,g: BEEP .008,60-2*g: NEXT g
5022 CLS
5025 IF capital+stock<1 THEN GO TO 8000: REM bankrupt
5027 IF capital+stock>999999 THEN PRINT FLASH 1; BRIGHT 1; INK 2;"You've made a million!!": PAUSE 500: GO TO 8050
5030 PRINT INK 2; FLASH 1;" FACTORY REPORT: WEEK ";WEEK;" "
5040 PRINT ' INK 2;"Capital on hand is $";capital
5050 PRINT ' INK 1;"Your stores hold ";stock;" Zibbies";TAB 10;"worth $";stock*sellprice
5060 PRINT INK 2;'"They sell for $";sellprice;" each"
5070 PRINT INK 2;"and cost $";cost;" each to make"
5080 PRINT INK 7; PAPER 1;'"Workforce is ";workforce;" people"
5090 PRINT PAPER 1; INK 7;"Their wages are $";wage;" each"," and the wage bill this week"," is $";wage*workforce
5100 PRINT INK 2;'"Each person can make ";produce;" Zibbies a week, a total output of ";produce*workforce
5120 RETURN
5130 INPUT "How many do you want to make? ";make
5135 IF make=0 THEN RETURN
5140 IF make*cost>capital THEN PRINT INK 2; FLASH 1;"Not enough money": GO TO 5130
5150 IF make>produce*workforce THEN PRINT INK 4; FLASH 1;"Not enough people": GO TO 5130
5160 PRINT AT 0,0; FLASH 1; INK 1;" Target week ";week;" is ";make;" "
5170 LET make=make-INT (RND*make/5*(z/100))
5180 PAUSE 100
5190 PRINT INK 3; FLASH 1;AT 0,0;"Total made in week ";week;" was ";make;" "
5200 LET stock=stock+make
5210 LET capital=capital-cost*make
5220 PAUSE 50
5300 RETURN
6000 REM people
6010 INPUT "How many people do you want","to hire? ";a
6020 LET workforce=workforce+a
6030 PRINT AT 0,0; FLASH 1; INK 1;" Total workforce is ";workforce
6035 PAUSE 100: GO SUB 5000
6037 IF a>0 THEN RETURN
6040 INPUT "How many people do you want","to "; FLASH 1; INK 4;"fire? ";a
6042 IF a=0 THEN GO TO 6090
6045 IF a>workforce THEN GO TO 6040
6050 LET a=INT (RND*a+1)
6060 PAUSE 100
6070 PRINT FLASH 1; BRIGHT 1; INK 6; PAPER 2;'''"Unions allow you to fire ";a
6080 LET workforce=workforce-a
6090 PAUSE 100
6100 RETURN
8000 REM bankruptcy
8010 PRINT '''TAB 8; FLASH 1; INK 2;"BANKRUPT!!!!"
8020 PRINT '''"Oh the shame of it!"
8030 PRINT '''"Still, you kept the business"
8040 PRINT "going for "; FLASH 1; INK 1;week; FLASH 0; INK 0;" weeks"
8050 PRINT '''"Enter 'Y' for another try, or","'N' to give up"
8055 LET a$=INKEY$
8060 IF a$="" THEN GO TO 8055
8070 IF a$="Y" OR a$="y" THEN RUN
8080 STOP
9000 REM variables
9030 LET capital=500+INT (RND*500)
9040 LET stock=100+INT (RND*50)
9050 LET sellprice=10+INT (RND*5)
9060 LET cost=2+INT (RND*5)
9070 IF cost>sellprice THEN GO TO 9050
9080 LET workforce=7+INT (RND*10)
9090 LET wage=12+INT (RND*sellprice*5)
9100 LET produce=5+INT (RND*6)
9110 LET week=0
9120 REM RUN Z is sales resistance factor
9130 LET z=1
9140 PAPER 7: CLS : BORDER 7: INK 0
9500 RETURN
9999 SAVE "worksimul" LINE 1: BEEP 1,32
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
