-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathgoal.zil
586 lines (523 loc) · 16.4 KB
/
goal.zil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
"GOAL for
SUSPENDED
Copyright 1982 Infocom, Inc. All rights reserved.
"
"This code is the local T system."
<GLOBAL DIR-STRINGS
<PTABLE P?NORTH "north" P?SOUTH "south"
P?EAST "east" P?WEST "west"
P?NW "northwest" P?NE "northeast"
P?SW "southwest" P?SE "southeast"
P?DOWN "downstairs" P?UP "upstairs"
P?IN "in" P?OUT "out">>
"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>
<GLOBAL A-LINE
<PTABLE 0 SKY3 P?EAST
P?WEST SKY2 P?EAST
P?WEST SKY1 P?SOUTH
P?NORTH NE-PASSAGE2 P?SW
P?NE NE-PASSAGE1 0>>
<GLOBAL B-LINE
<PTABLE 0 SUPPLIES-MID P?NORTH
P?SOUTH SUPPLIES-NORTH P?EAST
P?WEST WEATHER-BANKS P?EAST
P?WEST CPU-ROOM P?NE
P?SW CORRIDOR-1 P?NE
P?SW CORRIDOR-2 P?EAST
P?WEST HALLWAY-JUNCTION P?SOUTH
P?NORTH OUTSIDE-CLC P?SOUTH
P?NORTH PERIPH-1 P?SE
P?NW PERIPH-2 P?SW
P?NE PERIPH-3 P?NW
P?SE PERIPH-4 P?EAST
P?WEST CLC-CORE 0>>
<GLOBAL C-LINE
<PTABLE 0 REPAIR3 P?NORTH
P?SOUTH REPAIR2 P?NORTH
P?SOUTH REPAIR1 P?NORTH
P?SOUTH ROBOT-Z P?NW
P?SE ROBOT-PASSAGE P?NW
P?SE CORRIDOR-3 P?EAST
P?WEST CORRIDOR-4 P?EAST
P?WEST ACIDMIST P?EAST
P?WEST MIDMIST P?NE
P?SW FC1 P?SOUTH
P?NORTH TUBE2 P?SOUTH
P?NORTH FC2 P?SOUTH
P?NORTH TUBE1 P?SOUTH
P?NORTH FC3 0>>
<GLOBAL D-LINE
<PTABLE 0 HUMAN-ENTRY P?NORTH
P?SOUTH HALL-STOP3 P?WEST
P?EAST HALL-STOP2 P?WEST
P?EAST HALL-STOP1 P?WEST
P?EAST NORTH-ENTRY P?WEST
P?EAST DEAD-END-1 0>>
<GLOBAL E-LINE
<PTABLE 0 STERILE-AREA P?EAST
P?WEST DECON-CHAMBER P?EAST
P?WEST ENTRY-AREA P?EAST
P?WEST TOOL-AREA P?EAST
P?WEST REC-AREA P?EAST
P?WEST SLEEP-CHAMBER 0>>
<GLOBAL F-LINE
<PTABLE 0 HALL-STOP4 P?EAST
P?WEST HALL-STOP5 P?SOUTH
P?NORTH HALL-T P?SOUTH
P?NORTH LOWER-CORE P?SOUTH
P?NORTH HALL-END P?EAST
P?WEST CAR-AREA P?NORTH
P?SOUTH BIO-INT P?NORTH
P?SOUTH CRYOUNITS 0>>
<GLOBAL TRANSFER-TABLE
<PTABLE 0 0
NE-PASSAGE1 CORRIDOR-4
NE-PASSAGE1 CORRIDOR-4
NE-PASSAGE1 CORRIDOR-4
NE-PASSAGE1 CORRIDOR-4
NE-PASSAGE1 CORRIDOR-4
HALLWAY-JUNCTION CORRIDOR-3
0 0
HALLWAY-JUNCTION CORRIDOR-3
HALLWAY-JUNCTION HUMAN-ENTRY
HALLWAY-JUNCTION HUMAN-ENTRY
HALLWAY-JUNCTION HUMAN-ENTRY
CORRIDOR-4 NE-PASSAGE1
CORRIDOR-3 HALLWAY-JUNCTION
0 0
CORRIDOR-3 HALLWAY-JUNCTION
CORRIDOR-3 HALLWAY-JUNCTION
CORRIDOR-3 HALLWAY-JUNCTION
HUMAN-ENTRY HALLWAY-JUNCTION
HUMAN-ENTRY HALLWAY-JUNCTION
HUMAN-ENTRY HALLWAY-JUNCTION
0 0
NORTH-ENTRY STERILE-AREA
HALL-STOP3 HALL-STOP4
SLEEP-CHAMBER HALL-STOP5
SLEEP-CHAMBER HALL-STOP5
SLEEP-CHAMBER HALL-STOP5
SLEEP-CHAMBER HALL-STOP5
0 0
SLEEP-CHAMBER HALL-STOP5
HALL-STOP4 HALL-STOP3
HALL-STOP4 HALL-STOP3
HALL-STOP4 HALL-STOP3
HALL-STOP4 HALL-STOP3
HALL-STOP5 SLEEP-CHAMBER
0 0>>
<GLOBAL COR-1
<PTABLE P?WEST P?EAST
STERILE-AREA DECON-CHAMBER ENTRY-AREA TOOL-AREA REC-AREA
SLEEP-CHAMBER 0>>
<GLOBAL COR-2
<PTABLE P?WEST P?EAST
DEAD-END-1 NORTH-ENTRY HALL-STOP1 HALL-STOP2 HALL-STOP3
HALL-STOP4 HALL-STOP5 0>>
<GLOBAL COR-4
<PTABLE P?NORTH P?SOUTH
HALL-STOP3 HUMAN-ENTRY HALLWAY-JUNCTION 0>>
<GLOBAL COR-8
<PTABLE P?SW P?NE
CPU-ROOM CORRIDOR-1 CORRIDOR-2 0>>
<GLOBAL COR-16
<PTABLE P?WEST P?EAST
CORRIDOR-2 HALLWAY-JUNCTION CORRIDOR-3 CORRIDOR-4 ACIDMIST MIDMIST 0>>
<GLOBAL COR-32
<PTABLE P?NORTH P?SOUTH
SLEEP-CHAMBER HALL-STOP5 HALL-T LOWER-CORE HALL-END 0>>
<GLOBAL COR-64
<PTABLE P?WEST P?EAST
HALL-END CAR-AREA 0>>
<GLOBAL COR-128
<PTABLE P?SW P?NE
CORRIDOR-4 NE-PASSAGE1 NE-PASSAGE2 0>>
<GLOBAL COR-256
<PTABLE P?WEST P?EAST
SKY4 SKY3 SKY2 SKY1 0>>
"CODE"
<ROUTINE KILL-GOAL (RBT "OPTIONAL" (DRAG <>) "AUX" GT OFFSET)
<SET OFFSET <GETP .RBT ,P?ROBOT>>
<SET GT <GET ,GOAL-TABLES .OFFSET>>
<PUT .GT ,GOAL-S <>>
<PUT .GT ,GOAL-F <>>
<PUT .GT ,GOAL-ENABLE T>
<COND (.DRAG
<PUT ,DRAG-TBL .OFFSET 0>)>
<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>)
<SET GT <GET ,GOAL-TABLES <GETP .RBT ,P?ROBOT>>>
<PUT .GT ,GOAL-I <+ <* <GETP .HERE ,P?LINE> 12>
<* <GETP .GOAL ,P?LINE> 2>>>
<PUT .GT ,GOAL-S <GETP .GOAL ,P?STATION>>
<PUT .GT ,GOAL-F .GOAL>
<PUT .GT ,GOAL-ENABLE T>
<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>)
<SET GT <GET ,GOAL-TABLES <GETP .RBT ,P?ROBOT>>>
<COND (<==? .HERE <GET .GT ,GOAL-F>>
<ARRIVAL .RBT>
<COND (<NOT <EQUAL? .RBT ,PEOPLE>>
<RTRUE>)
(T <RFALSE>)>)
(<NOT <GET .GT ,GOAL-ENABLE>> <RFALSE>)>
%<COND (<GASSIGNED? PREDGEN>
'<COND (<NOT <EQUAL? <SET LOC <GETP .HERE ,P?STATION>>
.HERE>>
<RETURN <MOVE-RBT .RBT .LOC>>)>)
(T
'<COND (<NOT <EQUAL? <SET LOC ,<GETP .HERE ,P?STATION>>
.HERE>>
<RETURN <MOVE-RBT .RBT .LOC>>)>)>
<COND (<==? <SET GOAL <GET ,TRANSFER-TABLE
<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
<MOVE-RBT .RBT
<GET ,TRANSFER-TABLE
<+ .IGOAL 1>>>>>
<SET-GOAL .RBT <GET .GT ,GOAL-F>>)>
<RETURN .FLG>)
(<NOT <==? .HERE <GET .GT ,GOAL-F>>>
<MOVE-RBT .RBT <GET .GT ,GOAL-F>>
<RETURN <ARRIVAL .RBT>>)
(T
<RETURN <ARRIVAL .RBT>>)>)>
<SET LINE <GET-LINE <GETP .GOAL ,P?LINE>>>
<REPEAT ()
<COND (<==? <SET RM <GET .LINE .CNT>> .HERE>
<COND (.GOAL-FLAG
<SET LOC <GET .LINE <- .CNT 3>>>)
(T
<SET LOC <GET .LINE <+ .CNT 3>>>)>
<RETURN <MOVE-RBT .RBT .LOC>>)
(<==? .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)
<SET OFFSET <GETP .RBT ,P?ROBOT>>
<SET GT <GET ,GOAL-TABLES .OFFSET>>
<SET TEMP ,WINNER>
<CHANGE-WINNER .RBT T>
<COND (<EQUAL? ,WINNER .TEMP>
<ROBOT-TELL <GET ,STUCK-QUIPS ,ROFF> <>>)
(T
<TELL <GET ,INTER-TBL ,ROFF> " " <GET ,STUCK-QUIPS ,ROFF>>)>
<TELL SD <LOC .RBT> " to ">
<COND (<IRIS?>
<TELL "Angling Corridor">)
(T
<TELL SD .WHERE>)>
<TELL ". " <GET ,MORE-STUCKS ,ROFF> CR>
<KILL-GOAL .RBT>
<PUT ,ROBOT-FOLLOW .OFFSET 0>
<PUT ,FOLLOW-TBL ,ROFF 0>
<CHANGE-WINNER .TEMP T>
<RTRUE>>
<ROUTINE MOVE-RBT (RBT WHERE "AUX" (L <LOC .RBT>) (COUNT 0) FLOC FROB)
#DECL ((RBT WHERE) OBJECT)
<COND (<MOVE-RBT? .RBT .L .WHERE>
<RTRUE> ;"Prints something")>
<REPEAT ()
<SET COUNT <+ .COUNT 1>>
<COND (<EQUAL? .COUNT 7>
<RETURN>)>
<COND (<EQUAL? <GET ,FOLLOW-TBL .COUNT> .RBT>
<SET FROB <GET ,NAME-TBL <- .COUNT 1>>>
<SET FLOC <LOC .FROB>>
<COND (<AND <EQUAL? .FROB ,IRIS>
<EQUAL? ,CORRIDOR-1 .WHERE>>
<STUCK ,IRIS ,CPU-ROOM>)
(T
<MOVE-RBT? .FROB .FLOC .WHERE>)>)>>
<RFALSE>>
<ROUTINE MOVE-RBT? (RBT L WHERE)
<COND (<AND <EQUAL? .L ,HUMAN-ENTRY ,HALLWAY-JUNCTION>
<EQUAL? .WHERE ,HUMAN-ENTRY ,HALLWAY-JUNCTION>
<NOT <EQUAL? ,WEDGE-PLACED 2>>
;<NOT <EQUAL? <LOC ,WEDGE> ,HUMAN-ENTRY ,HALLWAY-JUNCTION>>
<NOT <EQUAL? .RBT ,PEOPLE>>>
<STUCK .RBT .WHERE>
<RTRUE>)
(<AND <EQUAL? .L ,CORRIDOR-4>
<EQUAL? .WHERE ACIDMIST>
<NOT ,ACID-FIXED>
<NOT <EQUAL? ,PEOPLE .RBT>>>
<COND (<EQUAL? <GET ,DEADBOTS <GETP .RBT ,P?ROBOT>> 0>
<PUT ,DEADBOTS <GETP .RBT ,P?ROBOT> 1>
<DO-THE-MOVE .RBT .L .WHERE>
<RFALSE>)
(T
<DO-THE-MOVE .RBT .L .WHERE>
<RFALSE>)>)
(<AND <EQUAL? .L ,HALL-END ,CAR-AREA>
<EQUAL? .WHERE ,HALL-END ,CAR-AREA>>
<STUCK .RBT .WHERE>
<RTRUE>)
(<AND <EQUAL? .RBT ,IRIS>
<EQUAL? .L ,CPU-ROOM ,CORRIDOR-1>
<EQUAL? .WHERE ,CORRIDOR-1 ,CORRIDOR-2>>
<MOVE ,IRIS ,CPU-ROOM>
<SET .WHERE ,CORRIDOR-1>
<SET .L ,CPU-ROOM>
<STUCK .RBT .WHERE>
<RTRUE>)
(ELSE
<DO-THE-MOVE .RBT .L .WHERE>
<RFALSE>)>>
<ROUTINE DO-THE-MOVE (RBT L WHERE "AUX" DRAGEE)
<MOVE .RBT .WHERE>
<COND (<==? .RBT ,WINNER>
<SETG WINNER-HERE .WHERE>)>
<PUT ,LAST-ROOM <GETP .RBT ,P?ROBOT> .L>
<COND (<NOT <EQUAL? .RBT ,PEOPLE>>
<COND (<NOT <EQUAL?
<SET DRAGEE
<GET ,DRAG-TBL
<GETP .RBT ,P?ROBOT>>> 0>>
<MOVE .DRAGEE .WHERE>
<PUT ,LAST-ROOM <GETP .DRAGEE ,P?ROBOT> .L>)>)>
<RFALSE>>
<ROUTINE COR-DIR (HERE THERE "AUX" COR RM (PAST 0) (CNT 2))
<SET COR <GET-COR <BAND <GETP .THERE ,P?CORRIDOR>
<GETP .HERE ,P?CORRIDOR>>>>
<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)
<COND (<==? .LN 0> ,A-LINE)
(<==? .LN 1> ,B-LINE)
(<==? .LN 2> ,C-LINE)
(<==? .LN 3> ,D-LINE)
(<==? .LN 4> ,E-LINE)
(T ,F-LINE)>>
<ROUTINE GET-COR (NUM)
#DECL ((NUM) FIX)
<COND (<==? .NUM 1> ,COR-1)
(<==? .NUM 2> ,COR-2)
(<==? .NUM 4> ,COR-4)
(<==? .NUM 8> ,COR-8)
(<==? .NUM 16> ,COR-16)
(<==? .NUM 32> ,COR-32)
(<==? .NUM 64> ,COR-64)
(<==? .NUM 128> ,COR-128)
(T ,COR-256)>>
<ROUTINE DIR-PRINT (DIR "AUX" (CNT 0))
#DECL ((DIR CNT) FIX)
<REPEAT ()
<COND (<==? <GET ,DIR-STRINGS .CNT> .DIR>
<COND (<NOT <EQUAL? .DIR ,P?UP ,P?DOWN>>
<TELL "the ">)>
<PRINT <GET ,DIR-STRINGS <+ .CNT 1>>>
<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."
<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>
<TABLE <> <> <> <> 1 <> <> G-PEOPLE>>>
<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)
<GET <GET ,GOAL-TABLES <GETP .RBT ,P?ROBOT>> ,GOAL-F>>
<ROUTINE I-FOLLOW ("AUX" (FLG <>) (CNT 0) GT)
<REPEAT ()
<COND (<G? <SET CNT <+ .CNT 1>> ,CHARACTER-MAX>
<RETURN>)
(<AND <GET <SET GT <GET ,GOAL-TABLES .CNT>> ,GOAL-S>
<GET .GT ,GOAL-ENABLE>>
<PUT .GT ,GOAL-ENABLE T>
<COND (<FOLLOW-GOAL <GET ,CHARACTER-TBL .CNT>>
<SET FLG T>)>)>>
.FLG>
<ROUTINE ARRIVAL (RBT "AUX" GT)
<SET GT <GET ,GOAL-TABLES <GETP .RBT ,P?ROBOT>>>
<PUT .GT ,GOAL-S <>>
<PUT .GT ,GOAL-F <>>
<APPLY <GET .GT ,GOAL-FUNCTION> .RBT ,G-REACHED>
<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)
<COND (<==? .GARG ,G-REACHED>
<SET TEMP ,WINNER>
<CHANGE-WINNER .RBT T>
<CRLF>
<COND (<EQUAL? ,WINNER .TEMP>
<ROBOT-TELL <GET ,ARRIVAL-QUIPS ,ROFF> <>>)
(T
<TELL <GET ,INTER-TBL ,ROFF> " "
<GET ,ARRIVAL-QUIPS ,ROFF>>)>
<KILL-GOAL ,WINNER T>
<TELL SD <LOC ,WINNER> ".">
<COND (<NOT <EQUAL? <SET CHASED <GET ,ROBOT-FOLLOW ,ROFF>> 0>>
<COND (<NOT <EQUAL? <LOC .CHASED> <LOC .RBT>>>
<TELL " Looks like I missed "
D .CHASED " though." CR>)>)>
<PUT ,ROBOT-FOLLOW <GETP .RBT ,P?ROBOT> 0>
<APPLY <GETP ,WINNER-HERE ,P?ACTION> ,M-ENTER>
<CRLF>
<CHANGE-WINNER .TEMP T>
<RFATAL>)>>
;"NOTE: Follow-tbl, found in VERBS, puts the person to be followed into the
table.
NOTE: ROBOT-FOLLOW is used to indicate the robot expected to be found on
arrival, set by GO TO a ROBOT.
NOTE: LAST-ROOM is a table used by the verb FOLLOW to determine whether or
the robot to be followed was just here."
<GLOBAL ROBOT-FOLLOW
<LTABLE 0 0 0 0 0 0>>
<GLOBAL DRAG-TBL
<LTABLE 0 0 0 0 0 0 0>>
<GLOBAL LAST-ROOM
<LTABLE 0 0 0 0 0 0 0>>
<ROUTINE G-PEOPLE (RBT GARG "AUX" COUNT)
<COND (<==? .GARG ,G-REACHED>
<COND (<EQUAL? ,PR-NUMBER 1>
<PARRIVE1>)
(<EQUAL? ,PR-NUMBER 2>
<PARRIVE2>)
(<EQUAL? ,PR-NUMBER 3>
<PARRIVE3>)
(<EQUAL? ,PR-NUMBER 4>
<PARRIVE4>)
(<EQUAL? ,PR-NUMBER 5>
<PARRIVE5>)
(<EQUAL? ,PR-NUMBER 6>
<PARRIVE6>)
(<EQUAL? ,PR-NUMBER 7>
<PARRIVE7>)
(<EQUAL? ,PR-NUMBER 8>
<PARRIVE8>)
(<EQUAL? ,PR-NUMBER 9>
<PARRIVE9>)>)>>
"Routines to do looking down corridors"
<ROUTINE CORRIDOR-LOOK ("OPTIONAL" (ITM <>) "AUX" C Z COR VAL (FOUND <>))
<COND (<SET C <GETP ,WINNER-HERE ,P?CORRIDOR>>
<REPEAT ()
<COND (<NOT <L? <SET Z <- .C 256>> 0>>
<SET COR ,COR-256>)
(<NOT <L? <SET Z <- .C 128>> 0>>
<SET COR ,COR-128>)
(<NOT <L? <SET Z <- .C 64>> 0>>
<SET COR ,COR-64>)
(<NOT <L? <SET Z <- .C 32>> 0>>
<SET COR ,COR-32>)
(<NOT <L? <SET Z <- .C 16>> 0>>
<SET COR ,COR-16>)
(<NOT <L? <SET Z <- .C 8>> 0>>
<SET COR ,COR-8>)
(<NOT <L? <SET Z <- .C 4>> 0>>
<SET COR ,COR-4>)
(<NOT <L? <SET Z <- .C 2>> 0>>
<SET COR ,COR-2>)
(<NOT <L? <SET Z <- .C 1>> 0>>
<SET COR ,COR-1>)
(T <RETURN>)>
<SET VAL <CORRIDOR-CHECK .COR .ITM>>
<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>)
(<==? .RM ,WINNER-HERE> <SET PAST 1>)
(<SET OBJ <FIRST? .RM>>
<REPEAT ()
<COND (.ITM
<COND (<==? .OBJ .ITM>
<SET FOUND <GET .COR .PAST>>
<RETURN>)>)
(<GETP .OBJ ,P?ROBOT>
<COND (<EQUAL? <GETP .OBJ ,P?ROBOT> 7>
<TELL "Some " D .OBJ " are ">)
(ELSE
<TELL D .OBJ " is ">)>
<COND (<IN-MOTION? .OBJ>
<TELL "in motion ">)>
<TELL "off to ">
<DIR-PRINT <GET .COR .PAST>>
<DRAGGING? .OBJ>
<TELL ".">
<COND (<AND <EQUAL? .OBJ ,PEOPLE>
,CHASING-THIEF
<EQUAL? ,WINNER ,RTHIEF>>
<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)
<COND (<EQUAL? .RBT ,PEOPLE>
<RFALSE>)
(<NOT
<EQUAL? <SET DRAGEE <GET ,DRAG-TBL <GETP .RBT ,P?ROBOT>>> 0>>
<TELL ", dragging " D .DRAGEE>
<RFALSE>)>>
<ROUTINE IN-MOTION? (RBT "AUX" GT)
<SET GT <GET ,GOAL-TABLES <GETP .RBT ,P?ROBOT>>>
<COND (<AND <GET .GT ,GOAL-ENABLE>
<GET .GT ,GOAL-S>
<NOT <==? <LOC .RBT> <GET .GT ,GOAL-F>>>>
<RTRUE>)
(T <RFALSE>)>>
<GLOBAL CHARACTER-TBL <PLTABLE IRIS WALDO SENSA AUDA POET WHIZ PEOPLE>>