"GOAL for
SUSPENDED
Copyright 1982 Infocom, Inc. All rights reserved.
"
"This code is the local T system."
<GLOBAL DIR-STRINGS
"Rapid Transit Line Definitions and Identifiers"
<CONSTANT A-LINE-C 0>
<CONSTANT B-LINE-C 1>
<CONSTANT C-LINE-C 2>
<CONSTANT D-LINE-C 3>
<CONSTANT E-LINE-C 4>
<CONSTANT F-LINE-C 5>
These tables define the six “transit lines” which let robots travel around the map. Every room is either on or adjacent to a transit line.
<GLOBAL A-LINE
<GLOBAL B-LINE
<GLOBAL C-LINE
<GLOBAL D-LINE
<GLOBAL E-LINE
<GLOBAL F-LINE
This is effectively a 6x6 table. Each entry is a pair of rooms which connects one “transit line” to another. If two lines don’t cross, the entry gives you the connection to the line that will get you one step closer.
(The “0 0” pairs are the blank diagonal entries.)
<GLOBAL TRANSFER-TABLE
<PTABLE 0 0
0 0
0 0
0 0
0 0
0 0>>
The nine COR-N tables define nine corridors of rooms that have sight-lines to each other. Each room in a corridor has that bit set in its CORRIDOR property.
This permits the game to display messages like “Poet is off to the northeast.”
<GLOBAL COR-1
<GLOBAL COR-2
<GLOBAL COR-4
<GLOBAL COR-8
<GLOBAL COR-16
<GLOBAL COR-32
<GLOBAL COR-64
<GLOBAL COR-128
<GLOBAL COR-256
There is no SKY4. The compiler silently stores a zero in that entry.
(This seems to be a recurring problem. Deadline had a nonexistent [SHALL-3|relative:../starcross/#SRC:GOAL-37] in one of its transit tables.)
SKY4 SKY3 SKY2 SKY1 0>>
"CODE"
<ROUTINE KILL-GOAL (RBT "OPTIONAL" (DRAG <>) "AUX" GT OFFSET)
<COND (.DRAG
<RFALSE>>
<ROUTINE SET-GOAL (RBT GOAL "AUX" (HERE <LOC .RBT>) HL GL GT)
#DECL ((RBT GOAL HERE) OBJECT (HL GL) FIX
(PRIORITY) <OR FALSE ATOM>)
<LOC .RBT>>
<ROUTINE FOLLOW-GOAL (RBT "AUX" (HERE <LOC .RBT>) LINE LN RM GT GOAL FLG
(GOAL-FLAG <>) (IGOAL <>) LOC (CNT 1) DIR)
#DECL ((RBT HERE LOC RM) OBJECT (LN CNT) FIX
(GOAL-FLAG) <OR ATOM FALSE>)
<COND (<==? .HERE <GET .GT ,GOAL-F>>
<COND (<NOT <EQUAL? .RBT ,PEOPLE>>
<RTRUE>)
(T <RFALSE>)>)
%<COND (<GASSIGNED? PREDGEN>
'<COND (<NOT <EQUAL? <SET LOC <GETP .HERE ,P?STATION>>
.HERE>>
(T
'<COND (<NOT <EQUAL? <SET LOC ,<GETP .HERE ,P?STATION>>
.HERE>>
<RETURN <MOVE-RBT .RBT .LOC>>)>)>
<SET IGOAL <GET .GT ,GOAL-I>>>> 0>
<SET IGOAL <>>
<SET GOAL <GET .GT ,GOAL-S>>)>
<COND (<NOT .GOAL> <RFALSE>)
(<==? .HERE .GOAL>
<COND (.IGOAL
<COND (<NOT <SET FLG
<+ .IGOAL 1>>>>>
<RETURN .FLG>)
(<NOT <==? .HERE <GET .GT ,GOAL-F>>>
(T
<REPEAT ()
<COND (<==? <SET RM <GET .LINE .CNT>> .HERE>
<COND (.GOAL-FLAG
<SET LOC <GET .LINE <- .CNT 3>>>)
(T
<SET LOC <GET .LINE <+ .CNT 3>>>)>
(<==? .RM .GOAL>
<SET GOAL-FLAG T>)>
<SET CNT <+ .CNT 3>>>>
<GLOBAL STUCK-QUIPS
<PLTABLE "Internal mapping doesn't extend from "
"Sonar doesn't detect an easy way to get from "
"Sensory mechanisms indicate it's impossible to get from "
"Holy earwax. I can't get from "
"Alas, stuck, stuck, stuck. I can't get from "
"CLC indicates I cannot relocate going from ">>
<GLOBAL MORE-STUCKS
<PLTABLE "I'm waiting for alternate instructions."
"Directions requested."
"Please advise."
"I'm listening for additional instructions."
"Tell me, oh leader, what to do next."
"Awaiting instructions.">>
<ROUTINE STUCK (RBT WHERE "AUX" GT TEMP OFFSET)
(T
<TELL SD <LOC .RBT> " to ">
<COND (<IRIS?>
<TELL "Angling Corridor">)
(T
<TELL SD .WHERE>)>
<RTRUE>>
Move a robot, and also any robot which is assigned to FOLLOW it. Calls MOVE-RBT? to do the dirty work.
<ROUTINE MOVE-RBT (RBT WHERE "AUX" (L <LOC .RBT>) (COUNT 0) FLOC FROB)
#DECL ((RBT WHERE) OBJECT)
<RTRUE> )>
<REPEAT ()
<SET COUNT <+ .COUNT 1>>
<COND (<EQUAL? .COUNT 7>
<RETURN>)>
<SET FLOC <LOC .FROB>>
<COND (<AND <EQUAL? .FROB ,IRIS>
(T
<RFALSE>>
A low-level routine which tries to move an individual robot. It checks for impassable exits, which means it can fail. Thus the question mark.
This calls the even lower-level DO-THE-MOVE routine to handle the actual object juggling.
This is called both by the transit-line system (MOVE-RBT) and by individual direction commands (GOTO).
<ROUTINE MOVE-RBT? (RBT L WHERE)
<RTRUE>)
<RFALSE>)
(T
<RFALSE>)>)
<RTRUE>)
(<AND <EQUAL? .RBT ,IRIS>
<RTRUE>)
(ELSE
<RFALSE>)>>
The lowest-level routine for moving an individual robot. This places the robot in the destination room. If the robot is dragging another (incapacitated) robot, this also moves the dragee. (See DRAG-TBL.)
This is called by MOVE-RBT?
<ROUTINE DO-THE-MOVE (RBT L WHERE "AUX" DRAGEE)
<MOVE .RBT .WHERE>
<COND (<NOT <EQUAL? .RBT ,PEOPLE>>
<COND (<NOT <EQUAL?
<SET DRAGEE
<MOVE .DRAGEE .WHERE>
<RFALSE>>
<ROUTINE COR-DIR (HERE THERE "AUX" COR RM (PAST 0) (CNT 2))
<REPEAT ()
<COND (<==? <SET RM <GET .COR .CNT>> .HERE>
<SET PAST 1>
<RETURN>)
(<==? .RM .THERE>
<RETURN>)>
<SET CNT <+ .CNT 1>>>
<GET .COR .PAST>>
<ROUTINE GET-LINE (LN)
<ROUTINE GET-COR (NUM)
#DECL ((NUM) FIX)
<COND (<==? .NUM 1> ,COR-1)
<ROUTINE DIR-PRINT (DIR "AUX" (CNT 0))
#DECL ((DIR CNT) FIX)
<REPEAT ()
<TELL "the ">)>
<RTRUE>)>
<SET CNT <+ .CNT 1>>>>
"Goal tables for the 6 characters, offset by a constant, which,
for a given robot, is the P?ROBOT property of the object."
The current movement goal of each character. The scheme is explained in the “Travel” tab.
<GLOBAL GOAL-TABLES
<TABLE <TABLE <> <> <> <> 1 <> <> I-FOLLOW>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<TABLE <> <> <> <> 1 <> <> G-ROBOT>
<CONSTANT CHARACTER-MAX 7>
"Offsets into GOAL-TABLEs"
<CONSTANT GOAL-F 0>
<CONSTANT GOAL-S 1>
<CONSTANT GOAL-I 2>
<CONSTANT GOAL-LDIR 3>
<CONSTANT GOAL-ENABLE 4>
<CONSTANT GOAL-PRIORITY 5>
<CONSTANT GOAL-QUEUED 6>
<CONSTANT GOAL-FUNCTION 7>
"Goal-function constants, similar to M-xxx in MAIN"
<CONSTANT G-REACHED 1>
<CONSTANT G-ENROUTE 2>
<ROUTINE GOAL? (RBT)
This timer handles ongoing robot movement. See FOLLOW-GOAL.
<ROUTINE I-FOLLOW ("AUX" (FLG <>) (CNT 0) GT)
<REPEAT ()
<RETURN>)
<SET FLG T>)>)>>
.FLG>
Called when a moving robot reaches its destination. Clears its GOAL-TABLES entry, then calls G-ROBOT to announce the arrival.
<ROUTINE ARRIVAL (RBT "AUX" GT)
<RTRUE>>
<GLOBAL ARRIVAL-QUIPS
<PLTABLE "I've reached my destination, the "
"Internal mapping indicates arrival at the "
"Sensory mechanisms match goal directive. I am at the "
"From what I can hear, I've arrived at the "
"As much as I can be anyplace, I'm here at the "
"CLC indicates matched arrival coordinates at the ">>
<ROUTINE G-ROBOT (RBT GARG "AUX" TEMP COUNT CHASED)
<CRLF>
(T
<COND (<NOT <EQUAL? <LOC .CHASED> <LOC .RBT>>>
<TELL " Looks like I missed "
D .CHASED " though." CR>)>)>
<CRLF>
<RFATAL>)>>
This table indicates which robot a given robot has been told to GO TO. (Not the same as FOLLOW-TBL! The name is confusing. “ROBOT-SEEKING” would have been clearer.)
<GLOBAL ROBOT-FOLLOW
<LTABLE 0 0 0 0 0 0>>
This table indicates which (incapacitated) robot is being dragged by a given (active) robot.
<GLOBAL DRAG-TBL
<LTABLE 0 0 0 0 0 0 0>>
As the comment says, a table used by FOLLOW.
<GLOBAL LAST-ROOM
<LTABLE 0 0 0 0 0 0 0>>
<ROUTINE G-PEOPLE (RBT GARG "AUX" COUNT)
"Routines to do looking down corridors"
<ROUTINE CORRIDOR-LOOK ("OPTIONAL" (ITM <>) "AUX" C Z COR VAL (FOUND <>))
<REPEAT ()
<COND (<NOT <L? <SET Z <- .C 256>> 0>>
(<NOT <L? <SET Z <- .C 128>> 0>>
(<NOT <L? <SET Z <- .C 64>> 0>>
(<NOT <L? <SET Z <- .C 32>> 0>>
(<NOT <L? <SET Z <- .C 16>> 0>>
(<NOT <L? <SET Z <- .C 8>> 0>>
(<NOT <L? <SET Z <- .C 4>> 0>>
(<NOT <L? <SET Z <- .C 2>> 0>>
(<NOT <L? <SET Z <- .C 1>> 0>>
(T <RETURN>)>
<COND (<NOT .FOUND> <SET FOUND .VAL>)>
<SET C .Z>>
.FOUND)>>
<ROUTINE CORRIDOR-CHECK (COR ITM "AUX" (CNT 2) (PAST 0) (FOUND <>) RM OBJ)
<REPEAT ()
<COND (<==? <SET RM <GET .COR .CNT>> 0>
<RFALSE>)
(<SET OBJ <FIRST? .RM>>
<REPEAT ()
<COND (.ITM
<COND (<==? .OBJ .ITM>
<SET FOUND <GET .COR .PAST>>
<RETURN>)>)
<COND (<EQUAL? <GETP .OBJ ,P?ROBOT> 7>
<TELL "Some " D .OBJ " are ">)
(ELSE
<TELL D .OBJ " is ">)>
<TELL "in motion ">)>
<TELL "off to ">
<TELL ".">
<COND (<AND <EQUAL? .OBJ ,PEOPLE>
<TELL
" They appear to be in hot pursuit.">)>
<CRLF>)>
<SET OBJ <NEXT? .OBJ>>
<COND (<NOT .OBJ> <RETURN>)>>
<COND (.FOUND <RETURN .FOUND>)>)>
<SET CNT <+ .CNT 1>>>>
<ROUTINE DRAGGING? (RBT "AUX" DRAGEE)
<RFALSE>)
(<NOT
<TELL ", dragging " D .DRAGEE>
<RFALSE>)>>
<ROUTINE IN-MOTION? (RBT "AUX" GT)
<NOT <==? <LOC .RBT> <GET .GT ,GOAL-F>>>>
<RTRUE>)
(T <RFALSE>)>>