This is a text adventure game in which the player must navigate a 36-room world, battle creatures, manage inventory, and ultimately defuse a “nullity bomb” to save the Earth. The map is built procedurally in the initialisation subroutine by setting up a grid of connections in the two-dimensional array K(36,6), with directions encoded as six compass/vertical entries per room, then selectively zeroing dead ends. Characters include I.T. (an extraterrestrial), a dragon/monster, a snake, and a hellhound, each governed by a state machine stored in a P() array column. The bomb-defusal puzzle at line 3820 checks that CODE x$ + CODE y$ = 217, which corresponds to choosing the green (“g”, code 103) and yellow (“y”, code 121) wires, or any other pair summing to 217—red (“r”, code 114) combined with either of the others does not qualify. Variables N0, N1, N2 and PI are seeded from DATA at line 5990, serving as readable constants throughout and also saving tokenised bytes versus literal integers.
Program Structure
The program is divided into clearly labelled subroutines, entered via GO SUB 5000 for initialisation and then a main loop at lines 110–170. The loop calls input (GO SUB 500), operations (GO SUB 1000), and output (GO SUB 800), terminating only on a win (CWD<5 check at line 160, which is actually checking if the player is dead—wound count ≥ 5 ends the game at line 170 with a sardonic congratulations).
- 5000–5990: Initialisation — arrays dimensioned, map connections built, DATA read.
- 500–600: Input parser — command matched against
H$()dictionary. - 800–880: Output — room description, visible object, available exits.
- 900–940: Inventory search utility — finds item
IVWBin carried bag arrayB(). - 1000–1269: Operations dispatcher — moves player, finds visible object and present person, calls action and person handlers.
- 1300–2900: Action handlers (kill, help, take, drop, inventory, bandage, light on/off, read), each at 200-line intervals.
- 3000–4092: Person/object handlers (I.T., dragon, snake, hellhound, bomb, barbecue), dispatched by computed
GO TO. - 4700–4925: Ambient subroutines — lantern fuel countdown, room-sequence puzzle.
Map Generation
The 36 rooms are arranged as a 4×9 (or conceptually 6×6) grid. Lines 5110–5210 first fill every room with connections in all four horizontal directions, then systematically zero out the edges using nested loops, producing a walled rectangular grid. Six special vertical (up/down) connections are then added from a READ statement at line 5230. This bulk-fill-then-prune technique avoids entering dozens of individual DATA values for the connection table.
Constant Variables N0, N1, N2, PI
The very first READ at line 5005 loads N0=0, N1=1, N2=2 from DATA. PI is the built-in constant (≈3.14159) but is used throughout as an integer index equal to 3 (relying on integer array indexing truncating it). This idiom saves tokenised space versus repeating the literals 0, 1, 2, 3 and is a recognised Sinclair BASIC memory optimisation. A side-effect is that DIM P(6,PI) creates a 6×3 matrix because PI truncates to 3 at dimension time.
Command Dispatch
The parser at line 530–560 does a prefix match: H$(I, TO LEN C$)=C$ tests whether the stored command starts with whatever the player typed. This means abbreviated input works automatically—typing “e” matches “east”, “k” matches “kill”, and so on. The matched index IHD drives two dispatch mechanisms:
- Directions (IHD 1–6): looked up directly in the connection table
K(IKM,IHD). - Actions (IHD 7–15): dispatched by computed
GO SUB 1300+(IHD-7)*200at line 1220, placing action subroutines exactly 200 lines apart.
State-Machine NPCs
Each of the six persons/objects has a state stored in column 2 of the P() array (P(I,N2)). State transitions use computed GO TO with a base address plus ten times the state value, e.g. GO TO 3220+P(N2,N2)*10 for the dragon handler. This gives states at lines …30, …40, …50, …60, …70, …80. Each handler stanza updates the state before returning, creating a simple but effective finite-state machine for narrative progression.
NPC State Summaries
| NPC | P() index | Base GO TO | States |
|---|---|---|---|
| I.T. | P(1,2) | 3020 | 1=arrives, 2=wants water, 3=talks, 4=coma intro, 5=coma ongoing |
| Dragon/Monster | P(2,2) | 3220 | 1=appears, 2=asks cookie, 3=louder, 4=aggressive, 5=eats cookie/sleeps, 6=sleeping |
| Snake | — | — | Stateless; random steal/move each visit |
| Hellhound | P(4,2) | 3620 | 1=appears, 2=attacks, 3=growls |
| Barbecue | P(6,2) | 4060 | 1=fire, 2=flash, 3=quiet |
| Bomb | — | 3800 | Puzzle sequence; no state variable |
Bomb Puzzle
The win condition at line 3910 is CODE x$+CODE y$=217. The three wires are “g” (103), “y” (121), “r” (114). The only pair summing to 217 is g+r (103+114=217) or y+r does not (121+114=235), and g+y (103+121=224) also fails. Therefore the unique solution is to cut the green and red wires. However, the narrative flavour text in the recipe (line 2970) hints at using a dead hellhound and wheat on the barbecue to make cookies for the dragon—this is the prerequisite chain to pass the monster and reach the bomb room, not the bomb solution itself.
Inventory System
Carried items are stored as object indices in array B(), with IBMAX tracking the next free slot (1-based). The utility subroutine at line 900 searches B() for a specific item number IVWB, returning its slot in IBZ. Dropping an item uses a swap-with-last idiom at line 2060: B(IBZ)=B(IBMAX-N1) followed by decrementing IBMAX, avoiding array compaction. The snake’s steal routine (line 3440) similarly decrements IBMAX after repositioning the stolen object in V().
Lantern Fuel
The ambient subroutine at lines 4700–4780 is called every turn when BLL=1 (lantern on). It decrements the counter CLL (initialised to 100 at line 5570). At CLL=5 a dim warning is printed; at CLL=0 the lantern extinguishes and BLL is set to 0. Rooms above index 24 are treated as outdoors (line 820), bypassing the darkness check.
Room-Sequence Puzzle
Lines 4860–4925 implement a hidden puzzle: array D(8) holds a required sequence of room visits. Counter CRO increments each turn (in non-cave rooms where IKM<12 and CRI<>8). If the player visits the rooms in the correct order (IKM=D(CRO) increments CRI), after 8 correct steps the secret north exit from room 2 is opened (K(N2,N1)=3). Wrong sequence resets both counters and teleports the player back to room 1 with a blackout narrative.
Bugs and Anomalies
- Line 160:
IF CWD<5 THEN GO TO 130— the condition for death isCWD≥5, so the death message at line 170 fires when the player has 5 or more wounds; the message “CONGRATULATIONS; you succeeded in killing yourself” is intentionally sarcastic. - Line 1470:
LET IVW=8+IPSassigns a corpse object index based on person slot; object slots 9–12 inV$()are pre-named “I.T.’s body”, “giant corpse”, “sliced snake”, “death hound” to match persons 1–4. - Line 3263: after a dragon blow, next state is
INT(RND*PI)+N2, which evaluates to 2, 3, or 4 — meaning the dragon can regress to an earlier state randomly, making it non-deterministically aggressive. - Line 1080:
LET i=6uses lowercaseito break aFOR Iloop — on the Spectrum this works because variable names are case-insensitive in numeric variables. - The
BEEP n1,n1calls at lines 2370 and 3272 use the variablen1(lowercase) for both duration and pitch; since numeric variables are case-insensitive this resolves toN1=1, producing a 1-second beep at middle C (note 1). - Line 3960 contains an infinite flashing congratulations loop with no exit — the game must be manually interrupted after winning the bomb puzzle.
Content
Source Code
100 GO SUB 5000
110 LET NKAM=N0: LET IHD=8
120 GO TO 140
130 GO SUB 500
140 GO SUB 1000
150 GO SUB 800
160 IF CWD<5 THEN GO TO 130
170 CLS : PRINT "CONGRATULATIONS; you succeeded in killing yourself.": STOP
500 REM INPUT
510 LET NKAM=N0: LET IHD=N0
520 INPUT "What would you like to do? ";C$
530 FOR I=N1 TO 15
540 IF H$(I, TO LEN C$)=C$ THEN LET IHD=I: LET I=16
550 NEXT I
560 IF IHD>6 THEN RETURN
570 IF NOT IHD THEN PRINT "I don't understand you.": GO TO 500
580 LET NKAM=K(IKM,IHD)
590 IF NKAM THEN RETURN
600 PRINT "You can't go in that direction.": GO TO 500
800 REM OUT
810 PRINT '"You are in the ";R$(IKM)
820 IF IKM>24 OR BLL=N1 THEN GO TO 840
830 PRINT "You can't see much here.": GO TO 850
840 IF IVW THEN PRINT "There is a ";V$(IVW);" here."
850 FOR I=N1 TO 6
860 IF K(IKM,I) THEN PRINT "You can go ";H$(I)
870 NEXT I
880 PRINT '" ***"'': RETURN
900 REM HOLDINGS
920 LET IBZ=N0: FOR I=N1 TO IBMAX-N1
930 IF B(I)=IVWB THEN LET IBZ=I: LET I=IBMAX
940 NEXT I: RETURN
1000 REM OPERATIONS
1010 IF NKAM THEN LET IKM=NKAM
1020 LET IVW=N0
1030 FOR I=N1 TO 12
1040 IF V(I)=IKM THEN LET IVW=I: LET I=12
1050 NEXT I: LET IPS=N0
1060 FOR I=N1 TO 6
1070 IF P(I,N1)=IKM THEN LET IPS=I: LET i=6
1080 NEXT I
1100 REM GENERAL OPERATIONS
1110 IF IKM<12 AND CRI<>8 THEN GO SUB 4860
1120 IF BLL=N1 THEN GO SUB 4700
1200 REM PERSONAL OPERATIONS
1210 IF IHD<7 THEN GO TO 1240
1220 GO SUB 1300+(IHD-7)*200
1230 REM HANDLERS
1240 IF NOT IPS THEN RETURN
1250 GO SUB 3000+(IPS-N1)*200
1269 RETURN
1300 REM KILL
1310 IF NOT IPS OR IPS>4 THEN PRINT "Time is the only thing you can kill here.": RETURN
1320 LET IVWB=7: GO SUB 900
1340 IF NOT IBZ THEN PRINT "It's suicide to attack with barehands.": RETURN
1350 PRINT "So you want to kill the ";P$(IPS)
1360 PRINT "You attack it with your sword"
1370 IF RND<.5 AND P(IPS,N2)<4 THEN PRINT "but your victim moves quickly","away.": GO TO 1395
1380 PRINT "and you give your victim a","terrible blow."
1390 LET P(IPS,PI)=P(IPS,PI)-N1
1395 IF RND>.2 THEN GO TO 1440
1400 PRINT "This is your chance; you can hithim again before he regains his feet"
1410 INPUT "Do you want to? ";Y$
1420 IF Y$(N1)<>"y" THEN GO TO 1440
1430 PRINT "You raise your sword again": GO TO 1370
1440 IF P(IPS,PI)>N1 THEN RETURN
1450 IF P(IPS,PI)=N1 THEN PRINT "Your victim is badly wounded.": RETURN
1460 PRINT "You have killed the ";P$(IPS)
1470 LET P(IPS,N1)=N0: LET IVW=8+IPS
1480 LET V(IVW)=IKM: LET IPS=N0: RETURN
1500 REM HELP
1510 PRINT "POSSIBLE COMMANDS"
1520 FOR I=N1 TO 15
1530 PRINT H$(I),;
1540 NEXT I: PRINT : RETURN
1700 REM TAKE
1720 IF NOT IVW THEN PRINT "There is nothing to take here.": RETURN
1740 PRINT "You now have the ";V$(IVW)
1750 LET B(IBMAX)=IVW
1770 LET V(IVW)=N0: LET IVW=N0
1790 LET IBMAX=IBMAX+N1: RETURN
1900 REM DROP
1910 INPUT "What do you wish to drop?",;D$
1920 LET IVWB=N0
1930 FOR I=N1 TO 12
1940 IF D$=V$(I, TO LEN d$) THEN LET IVWB=I: LET I=12
1950 NEXT I
1970 IF NOT IVWB THEN PRINT "I don't understand what you mean": RETURN
1990 GO SUB 900
2010 IF NOT IBZ THEN PRINT "You can't drop what you do not have.": RETURN
2030 PRINT "You dropped the ";V$(B(IBZ))
2040 LET IVW=B(IBZ)
2050 LET V(B(IBZ))=IKM
2060 LET B(IBZ)=B(IBMAX-N1)
2070 LET IBMAX=IBMAX-N1
2075 IF IKM<>25 THEN RETURN
2080 INPUT "Do you want to drop more? ";Y$
2085 IF Y$(N1)="y" THEN GO TO 1910
2090 RETURN
2100 REM INVENTORY
2120 IF IBMAX=N1 THEN PRINT "All you own is what yuor wearingnow.": GO TO 2180
2140 PRINT "You have the following items:"
2150 FOR I=N1 TO IBMAX-N1
2160 PRINT V$(B(I)): NEXT I
2180 PRINT "You can suffer ";5-CWD;" wounds before you die.": RETURN
2300 REM BANDAGE
2310 LET IVWB=6: GO SUB 900
2340 IF NOT IBZ THEN PRINT "You can't manage that without a bandage.": RETURN
2360 PRINT "That doesn't look very hopeful."
2370 PRINT "I will need all that you have.": BEEP n1,n1
2390 PRINT "So, that will hold for a while."
2400 LET CWD=N0
2410 LET B(IBZ)=B(IBMAX-N1)
2420 LET IBMAX=IBMAX-N1: RETURN
2500 REM LIGHT ON
2510 LET IVWB=N1: GO SUB 900
2540 IF NOT IBZ THEN PRINT "You can NOT do that without a lantern.": RETURN
2560 PRINT "The lantern is on now."
2570 LET BLL=CLL>N1: RETURN
2700 REM LIGHT OFF
2710 LET IVWB=N1: GO SUB 900
2740 IF NOT IBZ THEN PRINT "YOU DON'T EVEN HAVE A LANTERN.": RETURN
2760 PRINT "The lantern is off now."
2770 LET BLL=N0: RETURN
2900 REM READ
2910 LET IVWB=4: GO SUB 900
2920 IF NOT IBZ THEN PRINT "You have no books to read.": RETURN
2930 IF BLL=N1 OR IKM>24 THEN GO TO 2960
2940 PRINT "It is to dark to read here.": RETURN
2960 PRINT "This book has a recipe that","shows how to make cookies."
2970 PRINT "It says: take one dead HELLHOUNDand some wheat. Drop this on a barbecue and wait a few minutes."
2980 PRINT "That is all.": RETURN
3000 REM I.T.
3010 IF IVW=3 THEN LET P(N1,N2)=3: LET V(IVW)=N0: LET IVW=N0
3020 GO TO 3020+P(N1,N2)*10
3030 PRINT "I.T. (the intraterrestrial) is here."
3031 PRINT "It looks as though he's talking but you cann't understand him."
3033 LET P(N1,N2)=N2: RETURN
3040 PRINT "I.T. gestures that he needs something to drink"
3045 PRINT "He looks rather desperate": RETURN
3050 PRINT "I.T. gulps the water. He needed it very much. After a while he starts ";
3052 PRINT "talking again. Now you can understand him. He says:","PLEASE go down into the caves and find the nullity bomb. Some"
3055 PRINT "crazy professor wants to blow upthe earth with it.","I am so weak from a fight with the monster that guards it!"
3056 PRINT "Suddenly he falls into a coma."''"Now only you can save the Earth.": LET p(N1,2)=4: RETURN
3060 PRINT "It looks like the I.T. is still in a coma."
3061 PRINT "Now you have to do it on your own."
3062 PRINT FLASH N1;"GOOD LUCK"
3063 LET P(N1,N2)=5: RETURN
3070 PRINT "I.T. is here, he is in a coma.": RETURN
3200 REM DRAGON
3210 IF IVW=8 THEN LET P(N2,N2)=5: LET V(IVW)=N0: LET IVW=N0
3220 GO TO 3220+P(N2,N2)*10
3230 PRINT "There is an enormous monster","here. It's eyes are rolling","dangerously."
3232 PRINT "It yells: are you a cookie?"
3233 LET P(N2,N2)=N2: RETURN
3240 PRINT "The monster yells louder and louder."
3241 PRINT "ARE YOU A COOKIE?"
3242 LET P(N2,N2)=3: RETURN
3250 PRINT "It keeps yelling."
3251 PRINT "And it becomes rather aggressive"
3252 LET P(N2,N2)=4: RETURN
3260 PRINT "The monster gives you a terribleblow."
3261 PRINT "Your head is spinning."
3263 LET P(N2,N2)=INT (RND*PI)+N2
3264 LET CWD=CWD+N1: RETURN
3270 PRINT "The MONSTER says COOKIES? and starts to eat at once."
3272 PRINT "Then there is an enormous BONG and it falls asleep.": BEEP N1,N1
3273 LET K(16,6)=N1
3274 LET P(N2,N2)=6: RETURN
3280 PRINT "The Monster sleeps": RETURN
3400 REM SNAKE
3410 PRINT "There is a sneaky snake in here."
3420 IF RND<.4 THEN RETURN
3430 IF IBMAX=N1 OR RND<.5 THEN GO TO 3470
3440 LET IBMAX=IBMAX-N1
3450 LET V(B(IBMAX))=13+INT (RND*12)
3460 PRINT "With a quick move it picks some-thing up and sneaks away to","another place."
3480 LET P(PI,N1)=P(PI,N1)+3
3490 IF P(PI,N1)>24 THEN LET P(PI,N1)=P(PI,N1)-8
3500 RETURN
3600 REM HELLHOUND
3620 GO TO 3620+P(4,N2)*10
3630 PRINT "There is a giant HELLHOUND here."
3631 PRINT "It looks as though he wants you for dinner."
3632 LET P(4,N2)=N2: RETURN
3640 PRINT "The HELLHOUND attacts and bites you violently"
3641 LET CWD=CWD+N1
3642 LET P(4,N2)=3: RETURN
3650 PRINT "The HELLHOUND growls and seems prepared for another attact."
3651 LET P(4,N2)=N2+INT (RND*N2)
3652 RETURN
3800 REM BOMB
3810 PRINT "The nullity bomb is here."
3820 PRINT "There are three wires between the bomb and the time-mechanism;a green (g) one"'"a yellow (y) one"'"a red (r) one. You must","disconnect two of them to stop it."
3830 INPUT "Which will be the first one?";X$
3840 INPUT "Now the second one: ";Y$
3850 LET CBO=N0: LET C$="yrg"
3860 FOR I=N1 TO PI
3870 IF X$=C$(I) THEN LET CBO=CBO+N1
3880 IF Y$=C$(I) THEN LET CBO=CBO+N1
3890 NEXT I
3900 IF CBO<N2 THEN PRINT "Watch out: Wrong input": GO TO 3820
3910 IF CODE x$+CODE y$=217 THEN GO TO 3950
3920 CLS
3930 PRINT "You tried hard but unfortunatelyyou did not succeed."
3940 STOP
3960 CLS : FOR i=N0 TO 7: PRINT AT 10,n0; INK i;"Congratulations; You have","succeeded where","others have failed.": NEXT i: GO TO 3960
4000 REM BARBECUE
4010 IF NOT IVW THEN GO TO 4060
4020 LET P(6,N2)=N2
4030 IF V(2)=IKM AND V(12)=IKM THEN LET IVW=8: LET V(IVW)=IKM: LET V(2)=N0: LET V(12)=N0: GO TO 4060
4040 LET V(IVW)=N0: LET IVW=N0
4060 GO TO 4060+10*P(6,N2)
4070 PRINT "There is a giant barbecue here with a large fire under it.": RETURN
4080 PRINT "An enormous flash lightS up the place and a penetrating smell fills your nose."
4082 LET P(6,N2)=3: RETURN
4090 PRINT "Everything is quiet now, even the terrible smell has faded."
4092 LET P(6,N2)=N1: RETURN
4700 REM LIGHT
4710 LET CLL=CLL-BLL
4720 IF CLL>5 THEN RETURN
4730 IF CLL<>5 THEN GO TO 4760
4740 PRINT "The light of your lantern dims": BEEP .2,N1: RETURN
4760 IF CLL THEN RETURN
4770 PRINT "Your lantern goes out.": BEEP .5,N1
4780 LET BLL=N0: RETURN
4860 REM PUZZLE
4865 LET CRO=CRO+N1: IF CRO>8 THEN GO TO 4885
4870 IF IKM=D(CRO) THEN LET CRI=CRI+N1
4875 IF CRO<8 THEN RETURN
4880 IF CRO=8 THEN GO TO 4915
4885 PRINT "Strange things are happening."
4890 PRINT "Darkness covers you and it feelsas if something is lifting you."
4895 PRINT "For a moment you are unconciouS"
4900 LET CRO=N1: LET CRI=N1
4905 LET IKM=N1: RETURN
4915 PRINT "You hear a strange sound as if something is being pushed away."
4920 PRINT "Now it has stopped"
4925 LET K(N2,N1)=3: RETURN
5000 REM init
5005 READ N0,N1,N2: PRINT AT 10,n0;"Please stand by, we are locatingyou now."
5010 DIM K(36,6): DIM R$(36,15)
5020 DIM H$(15,15)
5030 DIM P(6,PI): DIM P$(6,10)
5040 DIM V(12): DIM V$(12,12)
5050 DIM B(12): DIM D(8)
5100 REM CONNECTIONS
5110 FOR I=N1 TO 36
5120 LET K(I,N1)=I+N1: LET K(I,N2)=I-N1
5130 LET K(I,PI)=I+4: LET K(I,4)=I-4
5140 NEXT I
5150 FOR I=N0 TO 24 STEP 12
5160 FOR J=N1 TO 9 STEP 4
5170 LET K(I+J+3,N1)=N0: LET K(I+J,N2)=N0
5180 NEXT J
5190 FOR J=N1 TO 4
5200 LET K(I+J+8,3)=N0: LET K(I+J,4)=N0
5210 NEXT J: NEXT I
5230 READ K(N1,5),K(7,5),K(13,5),K(18,5),K(32,6),K(35,6)
5400 REM FILL ARRAYS
5410 FOR I=N1 TO 15
5420 READ H$(I)
5430 READ IKM,IHD
5440 LET K(IKM,IHD)=N0: NEXT I
5450 FOR I=N1 TO 12
5460 READ V$(I)
5470 READ V(I): NEXT I
5480 FOR I=N1 TO 6
5490 READ P$(I)
5500 READ P(I,N1),P(I,PI): LET P(I,N2)=N1
5510 NEXT I
5520 FOR I=N1 TO 36
5530 READ R$(I): NEXT I
5540 FOR I=N1 TO 8
5550 READ D(I): NEXT I
5560 REM INIT PARAMITERS
5570 READ IKM,IBZ,IBMAX,CKM,CLL,BLL,CWD,CRO,CRI
5580 BEEP .5,12: CLS : RETURN
5990 DATA 0,1,2,16,15,32,35,13,18
6000 DATA "east",21,N1,"west",22,N2,"north",22,N1,"south",23,N2,"up",18,N1,"down",19,N2,"kill",16,3,"help",20,4,"take",11,N1,"drop",12,N2,"invent",7,N1,"bandage",8,N2,"lantern on",7,4,"lantern off",3,3,"read",N2,N1
6010 DATA "lantern",34,"wheatpile",30,"watersack",28,"cookbook",21,"leaflet",14,"bandages",15,"sword",13,"cookie",N0,"I.T.'s body",N0,"giant corpse",N0,"sliced snake",N0,"death hound",N0
6020 DATA "I.T.",34,N2,"monster",16,15,"snake",17,4,"hellhound",29,N2,"barbecue",8,N1,"bomb",25,N1
6030 DATA "reset cave","t-cave","secret corridor","control room","o-cave","i-cave","space cave","black room","p-cave","e-cave","n-cave","emptiness","small cave","rocky cave","smelly cave","dragon cave","snake cave","yellow cave","stream bank","stinky place","food cave","final cave","colored cave","ice cave","open place"
6040 DATA "woods","woods","woods","woods","woods","woods","woods","woods","woods","woods","woods"
6060 DATA N1,5,9,10,11,7,6,N2
6070 DATA 36,N1,N1,N0,100,N0,N0,N0,N0
9998 SAVE "IT" LINE 1
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

