
Twelve rooms and six things make a world to walk about in. Puzzles make it a game. BEACON has four, and every one is the same idea: something the game remembers, a flag, that the player's actions set and that other actions test.
| Puzzle | The flag | Set by | Tested by |
|---|---|---|---|
| The shed door is nailed shut | ShedOpen | OPEN DOOR WITH CROWBAR on the beach | going east from the beach |
| The tower is locked | TowerOpen | UNLOCK DOOR WITH KEY at its foot | going up from the base |
| The stairs are dark | Lit | LIGHT LANTERN, with the matches | going up the stairs, with the lantern carried |
| The great lamp is dry | Filled | FILL LAMP WITH OIL in the lamp room | LIGHT LAMP |
And a fifth flag, Won, set when the great lamp is lit, ends the game.
Hidden things. The matches start in the kitchen cupboard and the key in the bedroom drawer, out of sight: their place is -1, which is no room, so Look never lists them. OPEN CUPBOARD in the kitchen says what is inside and sets the matches' place to the kitchen, and from then on they are there to take.
Two nouns. OPEN DOOR WITH CROWBAR is verb 13, noun 26, preposition 40, noun 20. Open checks the second noun is the right one, and that it is carried. UNLOCK is handled by the same procedure as OPEN.
Everything the game says is a message. Say(16) is the nailed door, Say(21) the ending: the code holds message numbers and the disc holds the words.
The variables become:
var
Map: array[1..Rooms] of Room;
Obj: array[1..Things] of Thing;
Msg: file of Str255;
Here, V, N1, P, N2: Integer;
ShedOpen, TowerOpen, Lit, Filled,
Won, Quit: Boolean;
Line: Str40;
Start hides the matches and the key (place -1) and clears the flags. Here is all of it:
procedure Start;
begin
Obj[1].Name := 'a crowbar';
Obj[1].Place := 2;
Obj[2].Name := 'a lantern';
Obj[2].Place := 3;
Obj[3].Name := 'an oil can';
Obj[3].Place := 4;
Obj[4].Name := 'the logbook';
Obj[4].Place := 6;
Obj[5].Name := 'a box of matches';
Obj[5].Place := -1;
Obj[6].Name := 'an iron key';
Obj[6].Place := -1;
Here := 1;
ShedOpen := False;
TowerOpen := False;
Lit := False;
Filled := False;
Won := False;
Quit := False;
end;
Walk becomes, with the three ways that can be shut:
procedure Walk(D: Integer);
var
Dest: Integer;
begin
Dest := Map[Here].Exits[D];
if (Here = 1) and (D = 3)
and not ShedOpen then
Say(16)
else if (Here = 9) and (D = 5)
and not TowerOpen then
Say(15)
else if (Here = 10) and (D = 5)
and not (Lit and Carried(2)) then
Say(13)
else if Dest = 0 then
Writeln('You can''t go that way.')
else
begin
Here := Dest;
Look;
end;
end;
After Drop, add the three new verbs:
procedure Open;
begin
if (N1 = 27) and (Here = 7) then
begin
if Obj[5].Place = -1 then
begin
Say(24);
Obj[5].Place := 7;
end
else
Writeln('It is already open.');
end
else if (N1 = 28) and (Here = 8) then
begin
if Obj[6].Place = -1 then
begin
Say(25);
Obj[6].Place := 8;
end
else
Writeln('It is already open.');
end
else if (N1 = 26) and (Here = 1) then
begin
if ShedOpen then
Writeln('It is already open.')
else if (N2 = 20) and Carried(1) then
begin
Say(17);
ShedOpen := True;
end
else
Say(16);
end
else if (N1 = 26) and (Here = 9) then
begin
if TowerOpen then
Writeln('It is already open.')
else if (N2 = 25) and Carried(6) then
begin
Say(18);
TowerOpen := True;
end
else
Say(15);
end
else
Writeln('You can''t open that.');
end;
procedure Light;
begin
if not Carried(5) then
Say(23)
else if N1 = 21 then
begin
if not Near(2) then
Writeln('It isn''t here.')
else if Lit then
Writeln('It is already lit.')
else
begin
Say(19);
Lit := True;
end;
end
else if (N1 = 29) and (Here = 11) then
begin
if not Filled then
Say(22)
else
begin
Say(21);
Won := True;
end;
end
else
Writeln('You can''t light that.');
end;
procedure Fill;
begin
if (N1 <> 29) or (Here <> 11) then
Writeln('You can''t fill that.')
else if not Carried(3) then
Writeln('You have nothing to fill',
' it with.')
else if Filled then
Writeln('It is already full.')
else
begin
Say(20);
Filled := True;
Obj[3].Name := 'an empty oil can';
end;
end;
Act becomes:
procedure Act;
begin
case V of
1..6: Walk(V);
7: if (N1 > 0) or (P > 0) then
Writeln('Which way?')
else
Writeln('Go where?');
8: Look;
9: Inventory;
10: Take;
11: Drop;
12, 17: Examine;
13, 14: Open;
15: Light;
16: Fill;
18: Quit := True;
19: Writeln('Nothing happens.');
end;
end;
And in the main program, until Quit; becomes until Won or Quit;.
Starting from
BEACON3, read into a new work file BEACON4. Save before you run.
What you should see
The whole game. E on the beach: The shed door is nailed shut against the weather. With the crowbar: OPEN DOOR WITH CROWBAR, You lever the door open with the crowbar. The nails shriek and give., and the shed is open. Find the rest yourself; Appendix II has a solution. Lighting the great lamp ends the game, back at Turbo's >.
Start, change the matches' place from -1 to 7. What do you see in the kitchen, before opening anything?Walk, change not (Lit and Carried(2)) to not Lit. Light the lantern on the stairs, drop it, and go up. Should you be able to?Open, change (N2 = 20) and Carried(1) to (N2 = 25) and Carried(6). What opens the shed now?20.1 On the stairs, once the lantern is lit and carried, add a line to the description: Your lantern lights the way up.
20.2 LIGHT MATCHES should not say You can't light that.: make it say A match flares and dies.
20.3 Turn XYZZY into a hint: a different line depending on which puzzle comes next.
Worked solutions are in Appendix II.
A puzzle is a flag: set by one action, tested by another. Hidden things have the place -1 until they are found. Sentences with two nouns let Open check what it is being opened with. Every word the game says comes from BEACON.MSG by number.
S21, The Finished Game: a title, an ending, and a game that runs without Turbo.
This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.