Decision Maker 2 is a novelty program that randomly selects and displays one of ten managerial responses, such as “FIRE SOMEONE,” “PASS THE BUCK,” or “SEE YOUR ANALYST.” It initialises a two-dimensional string array of 10 strings, each up to 16 characters wide, then uses RND seeded by RANDOMIZE to pick a response. The program loops at line 200–210 to guarantee a result between 1 and 10, discarding any zero result from INT(10*RND). A keypress detected via a polling loop at line 400 clears the screen and restarts the decision cycle from line 10, which re-seeds the random number generator each time.
Program Analysis
Program Structure
The program is divided into clearly separated functional blocks by line-number ranges:
- Lines 5–20: Header REM, array declaration, and initial randomisation.
- Lines 100–175: Population of the
D$string array with the ten possible responses. - Lines 200–210: Random index generation with rejection sampling.
- Lines 300–420: Display, keypress wait, screen clear, and loop back.
- Lines 450–600: Housekeeping —
CLEAR,SAVE, andRUN(likely a post-save auto-run block).
Array and String Handling
DIM D$(10,16) at line 10 allocates a fixed-length string array of 10 rows, each 16 characters wide. The longest entry, "SEE YOUR ANALYST" (16 characters), exactly fills one row, confirming the dimension was chosen to fit the data. Shorter strings are automatically right-padded with spaces by the BASIC runtime, which is harmless here since only PRINT D$(R) is used and trailing spaces do not affect the displayed output visually.
Randomisation Strategy
RAND (line 20) re-seeds the random number generator on every pass through the main loop (the program returns to line 10 after each keypress). This means each decision cycle gets a fresh seed, reducing the chance of repetitive sequences in interactive use.
Lines 200–210 implement a simple rejection-sampling loop: INT(10*RND) produces values in the range 0–9, and any result less than 1 (i.e., exactly 0) is discarded by looping back to line 200. This shifts the effective range to 1–9, however — this is a bug: INT(10*RND) yields integers 0 through 9 inclusive, and values 1–9 pass the guard at line 210, meaning the index 10 is never reached. The response "RECONSIDER" stored in D$(10) can therefore never be displayed.
Key BASIC Idioms
- Keypress polling:
IF INKEY$="" THEN GOTO 400at line 400 is a standard busy-wait loop for detecting any keypress without halting execution. - Re-randomisation on loop: Jumping back to line 10 rather than line 200 means
RANDis called again each cycle, providing varied seeds. - CLS before loop: Line 410 clears the screen immediately after a keypress is detected, giving clean presentation for the next result.
Notable Techniques and Anomalies
| Line(s) | Observation |
|---|---|
200–210 | Bug: rejection of R<1 excludes only 0, so R is effectively 1–9; D$(10) (“RECONSIDER”) is unreachable. The guard should be IF R<1 OR R>10, or the formula changed to INT(10*RND)+1. |
450 | CLEAR after GOTO 10 is unreachable during normal execution; it only runs if the SAVE/RUN block below it is reached, suggesting these lines are a development/save-time artifact. |
500 | SAVE "1001%2" uses an inverse-video character (%2) in the filename, which acts as an auto-run flag on ZX81/TS1000 systems. |
600 | RUN following SAVE restarts the program immediately after saving, a common pattern for save-and-continue workflows. |
Response Table
| Index | Response | Reachable? |
|---|---|---|
| 1 | YES | Yes |
| 2 | FIRE SOMEONE | Yes |
| 3 | PASS THE BUCK | Yes |
| 4 | MAYBE | Yes |
| 5 | REORGANIZE | Yes |
| 6 | NO | Yes |
| 7 | SEE YOUR ANALYST | Yes |
| 8 | SIT ON IT | Yes |
| 9 | FORGET IT | Yes |
| 10 | RECONSIDER | No (bug) |
Content
Source Code
5 REM *DECISION MAKER 2*
10 DIM D$(10,16)
20 RAND
100 LET D$(1)="YES"
110 LET D$(2)="FIRE SOMEONE"
120 LET D$(3)="PASS THE BUCK"
130 LET D$(4)="MAYBE"
140 LET D$(5)="REORGANIZE"
150 LET D$(6)="NO"
160 LET D$(7)="SEE YOUR ANALYST"
170 LET D$(8)="SIT ON IT"
173 LET D$(9)="FORGET IT"
175 LET D$(10)="RECONSIDER"
200 LET R=INT (10*RND)
210 IF R<1 THEN GOTO 200
300 PRINT D$(R)
400 IF INKEY$="" THEN GOTO 400
410 CLS
420 GOTO 10
450 CLEAR
500 SAVE "1001%2"
600 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
