1035dd76173ff9187325478a6dba95538fa0643b
[mudsync.git] / worlds / bricabrac.scm
1 ;;; Mudsync --- Live hackable MUD
2 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
3 ;;;
4 ;;; This file is part of Mudsync.
5 ;;;
6 ;;; Mudsync is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or
9 ;;; (at your option) any later version.
10 ;;;
11 ;;; Mudsync is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ;;; General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with Mudsync.  If not, see <http://www.gnu.org/licenses/>.
18
19 ;;; Hotel Bricabrac
20
21 (use-modules (mudsync)
22              (mudsync container)
23              (8sync)
24              (oop goops)
25              (ice-9 control)
26              (ice-9 format)
27              (ice-9 match)
28              (rx irregex))
29
30
31 \f
32 ;;; Utilities, useful or otherwise
33 ;;; ==============================
34
35 (set! *random-state* (random-state-from-platform))
36
37 (define (random-choice lst)
38   (list-ref lst (random (length lst))))
39
40 ;; list of lists, lol.
41 (define-syntax-rule (lol (list-contents ...) ...)
42   (list (list list-contents ...) ...))
43
44 \f
45 ;;; Some simple object types.
46 ;;; =========================
47
48 (define-class <readable> (<gameobj>)
49   (read-text #:init-value "All it says is: \"Blah blah blah.\""
50              #:init-keyword #:read-text)
51   (commands
52    #:allocation #:each-subclass
53    #:init-thunk (build-commands
54                  ("read" ((direct-command cmd-read)))))
55   (actions #:allocation #:each-subclass
56            #:init-thunk (build-actions
57                          (cmd-read readable-cmd-read))))
58
59 (define (readable-cmd-read actor message . _)
60   (<- (message-from message) 'tell
61       #:text (slot-ref actor 'read-text)))
62
63
64 ;; This one is just where reading is the same thing as looking
65 ;; at the description
66 (define-class <readable-desc> (<gameobj>)
67   (commands
68    #:allocation #:each-subclass
69    #:init-thunk (build-commands
70                  ("read" ((direct-command cmd-look-at))))))
71
72 ;; This one allows you to take from items that are proxied by it
73 (define-actor <proxy-items> (<gameobj>)
74   ((cmd-take-from take-from-proxy))
75   (proxy-items #:init-keyword #:proxy-items))
76
77 (define* (take-from-proxy gameobj message
78                           #:key direct-obj indir-obj preposition
79                           (player (message-from message)))
80   (call/ec
81    (lambda (escape)
82      (for-each
83       (lambda (obj-sym)
84         (define obj-id (dyn-ref gameobj obj-sym))
85         (define goes-by
86           (mbody-val (<-wait obj-id 'goes-by)))
87         (when (ci-member direct-obj goes-by)
88           (<- obj-id 'cmd-take #:direct-obj direct-obj #:player player)
89           (escape #f)))
90       (slot-ref gameobj 'proxy-items))
91
92      (<- player 'tell
93         #:text `("You don't see any such " ,direct-obj " to take "
94                  ,preposition " " ,(slot-ref gameobj 'name) ".")))))
95
96
97 \f
98 ;;; Lobby
99 ;;; -----
100
101 (define (npc-chat-randomly actor message . _)
102   (define catchphrase
103     (random-choice (slot-ref actor 'catchphrases)))
104   (define text-to-send
105     ((slot-ref actor 'chat-format) actor catchphrase))
106   (<- (message-from message) 'tell
107       #:text text-to-send))
108
109 (define hotel-owner-grumps
110   '("Eight sinks!  Eight sinks!  And I couldn't unwind them..."
111     "Don't mind the mess.  I built this place on a dare, you
112 know?"
113     "(*tearfully*) Here, take this parenthesis.  May it serve
114 you well."
115     "I gotta get back to the goblin farm soon..."
116     "Oh, but I was going to make a mansion... a great,
117 beautiful mansion!  Full of ghosts!  Now all I have is this cruddy
118 mo... hotel.  Oh... If only I had more time!"
119     "I told them to paint more of the walls purple.
120 Why didn't they listen?"
121     "Listen to that overhead muzak.  Whoever made that doesn't
122 know how to compose very well!  Have you heard of the bands 'fmt'
123 or 'skribe'?  Now *that's* composition!"))
124
125 (define-class <chatty-npc> (<gameobj>)
126   (catchphrases #:init-value '("Blarga blarga blarga!")
127                 #:init-keyword #:catchphrases)
128   (chat-format #:init-value (lambda (npc catchphrase)
129                               `(,(slot-ref npc 'name) " says: \""
130                                 ,catchphrase "\""))
131                #:init-keyword #:chat-format)
132   (commands
133    #:allocation #:each-subclass
134    #:init-thunk (build-commands
135                  (("chat" "talk") ((direct-command cmd-chat)))))
136   (actions #:allocation #:each-subclass
137            #:init-thunk
138            (build-actions
139             (cmd-chat npc-chat-randomly))))
140
141 (define-class <sign-in-form> (<gameobj>)
142   (commands
143    #:allocation #:each-subclass
144    #:init-thunk (build-commands
145                  ("sign" ((prep-direct-command cmd-sign-form '("as"))))))
146
147   (actions #:allocation #:each-subclass
148            #:init-thunk (build-actions
149                          (cmd-sign-form sign-cmd-sign-in))))
150
151
152 (define name-sre
153   (sre->irregex '(: alpha (** 1 14 (or alphanum "-" "_")))))
154
155 (define forbidden-words
156   (append article preposition
157           '("and" "or" "but" "admin")))
158
159 (define (valid-name? name)
160   (and (irregex-match name-sre name)
161        (not (member name forbidden-words))))
162
163 (define* (sign-cmd-sign-in actor message
164                            #:key direct-obj indir-obj preposition)
165   (define old-name
166     (mbody-val (<-wait (message-from message) 'get-name)))
167   (define name indir-obj)
168   (if (valid-name? indir-obj)
169       (begin
170         (<-wait (message-from message) 'set-name! name)
171         (<- (slot-ref actor 'loc) 'tell-room
172             #:text (format #f "~a signs the form!\n~a is now known as ~a\n"
173                            old-name old-name name)))
174       (<- (message-from message) 'tell
175           #:text "Sorry, that's not a valid name.
176 Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic
177 character.\n")))
178
179
180 (define-class <summoning-bell> (<gameobj>)
181   (summons #:init-keyword #:summons)
182
183   (commands
184    #:allocation #:each-subclass
185    #:init-thunk (build-commands
186                  ("ring" ((direct-command cmd-ring)))))
187   (actions #:allocation #:each-subclass
188            #:init-thunk (build-actions
189                          (cmd-ring summoning-bell-cmd-ring))))
190
191 (define* (summoning-bell-cmd-ring bell message . _)
192   ;; Call back to actor who invoked this message handler
193   ;; and find out their name.  We'll call *their* get-name message
194   ;; handler... meanwhile, this procedure suspends until we get
195   ;; their response.
196   (define who-rang
197     (mbody-val (<-wait (message-from message) 'get-name)))
198
199   ;; Now we'll invoke the "tell" message handler on the player
200   ;; who rang us, displaying this text on their screen.
201   ;; This one just uses <- instead of <-wait, since we don't
202   ;; care when it's delivered; we're not following up on it.
203   (<- (message-from message) 'tell
204       #:text "*ring ring!*  You ring the bell!\n")
205   ;; We also want everyone else in the room to "hear" the bell,
206   ;; but they get a different message since they aren't the ones
207   ;; ringing it.  Notice here's where we make use of the invoker's
208   ;; name as extracted and assigned to the who-rang variable.
209   ;; Notice how we send this message to our "location", which
210   ;; forwards it to the rest of the occupants in the room.
211   (<- (gameobj-loc bell) 'tell-room
212       #:text
213       (format #f "*ring ring!*  ~a rings the bell!\n"
214               who-rang)
215       #:exclude (message-from message))
216   ;; Now we perform the primary task of the bell, which is to summon
217   ;; the "clerk" character to the room.  (This is configurable,
218   ;; so we dynamically look up their address.)
219   (<- (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned
220       #:who-summoned (message-from message)))
221
222
223 (define prefect-quotes
224   '("I'm a frood who really knows where my towel is!"
225     "On no account allow a Vogon to read poetry at you."
226     "Time is an illusion, lunchtime doubly so!"
227     "How can you have money if none of you produces anything?"
228     "On no account allow Arthur to request tea on this ship."))
229
230 (define-class <cabinet-item> (<gameobj>)
231   (take-me? #:init-value
232             (lambda _
233               (values #f #:why-not
234                       `("Hm, well... the cabinet is locked and the properitor "
235                         "is right over there.")))))
236
237 (define lobby
238   (lol
239    ('lobby
240     <room> #f
241     #:name "Hotel Lobby"
242     #:desc
243     '((p "You're in some sort of hotel lobby.  You see a large sign hanging "
244          "over the desk that says \"Hotel Bricabrac\".  On the desk is a bell "
245          "that says \"'ring bell' for service\".  Terrible music plays from a speaker "
246          "somewhere overhead.  "
247          "The room is lined with various curio cabinets, filled with all sorts "
248          "of kitschy junk.  It looks like whoever decorated this place had great "
249          "ambitions, but actually assembled it all in a hurry and used whatever "
250          "kind of objects they found lying around.")
251       (p "There's a door to the north leading to some kind of hallway."))
252     #:exits
253     (list (make <exit>
254             #:name "north"
255             #:to 'grand-hallway)))
256    ;; NPC: hotel owner
257    ('lobby:hotel-owner
258     <chatty-npc> 'lobby
259     #:name "a frumpy fellow"
260     #:desc
261     '((p "  Whoever this is, they looks totally exhausted.  They're
262 collapsed into the only comfortable looking chair in the room and you
263 don't get the sense that they're likely to move any time soon.
264   You notice they're wearing a sticker badly adhesed to their clothing
265 which says \"Hotel Proprietor\", but they look so disorganized that you
266 think that can't possibly be true... can it?
267   Despite their exhaustion, you sense they'd be happy to chat with you,
268 though the conversation may be a bit one sided."))
269     #:goes-by '("frumpy fellow" "fellow"
270                 "Chris Webber"  ; heh, did you rtfc?  or was it so obvious?
271                 "hotel proprietor" "proprietor")
272     #:catchphrases hotel-owner-grumps)
273    ;; Object: Sign
274    ('lobby:sign
275     <readable> 'lobby
276     #:name "the Hotel Bricabrac sign"
277     #:desc "  It strikes you that there's something funny going on with this sign.
278 Sure enough, if you look at it hard enough, you can tell that someone
279 hastily painted over an existing sign and changed the \"M\" to an \"H\".
280 Classy!"
281     #:read-text "  All it says is \"Hotel Bricabrac\" in smudged, hasty text."
282     #:goes-by '("sign"
283                 "bricabrac sign"
284                 "hotel sign"
285                 "hotel bricabrac sign"
286                 "lobby sign"))
287
288    ('lobby:bell
289     <summoning-bell> 'lobby
290     #:name "a shiny brass bell"
291     #:goes-by '("shiny brass bell" "shiny bell" "brass bell" "bell")
292     #:desc "  A shiny brass bell.  Inscribed on its wooden base is the text
293 \"ring me for service\".  You probably could \"ring the bell\" if you 
294 wanted to."
295     #:summons 'break-room:desk-clerk)
296
297    ('lobby:sign-in-form
298     <sign-in-form> 'lobby
299     #:name "sign-in form"
300     #:goes-by '("sign-in form" "form" "signin form")
301     #:desc '("It looks like you could sign this form and set your name like so: "
302              (i "sign form as <my-name-here>")))
303
304    ;; Object: curio cabinets
305    ;; TODO: respond to attempts to open the curio cabinet
306    ('lobby:cabinet
307     <proxy-items> 'lobby
308     #:proxy-items '(lobby:porcelain-doll
309                     lobby:1950s-robots
310                     lobby:tea-set lobby:mustard-pot
311                     lobby:head-of-elvis lobby:circuitboard-of-evlis
312                     lobby:teletype-scroll lobby:orange-cat-phone)
313     #:name "a curio cabinet"
314     #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet"
315                 "cabinet of curiosities")
316     #:desc (lambda _
317              (format #f "  The curio cabinet is full of all sorts of oddities!
318 Something catches your eye!
319 Ooh, ~a!" (random-choice
320            '("a creepy porcelain doll"
321              "assorted 1950s robots"
322              "an exquisite tea set"
323              "an antique mustard pot"
324              "the pickled head of Elvis"
325              "the pickled circuitboard of EVLIS"
326              "a scroll of teletype paper holding the software Four Freedoms"
327              "a telephone shaped like an orange cartoon cat")))))
328
329    ('lobby:porcelain-doll
330     <cabinet-item> 'lobby
331     #:invisible? #t
332     #:name "a creepy porcelain doll"
333     #:desc "It strikes you that while the doll is technically well crafted,
334 it's also the stuff of nightmares."
335     #:goes-by '("porcelain doll" "doll"))
336    ('lobby:1950s-robots
337     <cabinet-item> 'lobby
338     #:invisible? #t
339     #:name "a set of 1950s robots"
340     #:desc "There's a whole set of these 1950s style robots.
341 They seem to be stamped out of tin, and have various decorations of levers
342 and buttons and springs.  Some of them have wind-up knobs on them."
343     #:goes-by '("robot" "robots" "1950s robot" "1950s robots"))
344    ('lobby:tea-set
345     <cabinet-item> 'lobby
346     #:invisible? #t
347     #:name "a tea set"
348     #:desc "A complete tea set.  Some of the cups are chipped.
349 You can imagine yourself joining a tea party using this set, around a
350 nice table with some doilies, drinking some Earl Grey tea, hot.  Mmmm."
351     #:goes-by '("tea set" "tea"))
352    ('lobby:cups
353     <cabinet-item> 'lobby
354     #:invisible? #t
355     #:name "cups from the tea set"
356     #:desc "They're chipped."
357     #:goes-by '("cups"))
358    ('lobby:mustard-pot
359     <cabinet-item> 'lobby
360     #:invisible? #t
361     #:name "a mustard pot"
362     #:desc '((p "It's a mustard pot.  I mean, it's kind of cool, it has a
363 nice design, and it's an antique, but you can't imagine putting something
364 like this in a museum.")
365              (p "Ha... imagine that... a mustard museum."))
366     #:goes-by '("mustard pot" "antique mustard pot" "mustard"))
367    ('lobby:head-of-elvis
368     <cabinet-item> 'lobby
369     #:invisible? #t
370     #:name "the pickled head of Elvis"
371     #:desc '((p "It's a jar full of some briny-looking liquid and...
372 a free floating head.  The head looks an awful lot like Elvis, and
373 definitely not the younger Elvis.  The hair even somehow maintains
374 that signature swoop while suspended in liquid.  But of course it's
375 not Elvis.")
376              (p "Oh, wait, it has a label at the bottom which says:
377 \"This is really the head of Elvis\".  Well... maybe don't believe
378 everything you read."))
379     #:goes-by '("pickled head of elvis" "pickled head of Elvis"
380                 "elvis" "Elvis" "head" "pickled head"))
381    ('lobby:circuitboard-of-evlis
382     <cabinet-item> 'lobby
383     #:invisible? #t
384     #:name "the pickled circuitboard of Evlis"
385     #:desc '((p "It's a circuitboard from a Lisp Machine called EVLIS.
386 This is quite the find, and you bet just about anyone interested in
387 preserving computer history would love to get their hands on this.")
388              (p "Unfortunately, whatever moron did acquire this has
389 no idea what it means to preserve computers, so here it is floating
390 in some kind of briny liquid.  It appears to be heavily corroded.
391 Too bad..."))
392     #:goes-by '("pickled circuitboard of evlis" "pickled circuitboard of Evlis"
393                 "pickled circuitboard of EVLIS"
394                 "evlis" "Evlis" "EVLIS" "circuitboard" "pickled circuitboard"))
395    ('lobby:teletype-scroll
396     <cabinet-item> 'lobby
397     #:invisible? #t
398     #:name "a scroll of teletype"
399     #:desc '((p "This is a scroll of teletype paper.  It's a bit old
400 and yellowed but the type is very legible.  It says:")
401              (br)
402              (i
403               (p (strong "== The four essential freedoms =="))
404               (p "A program is free software if the program's users have
405 the four essential freedoms: ")
406               (ul (li "The freedom to run the program as you wish, for any purpose (freedom 0).")
407                   (li "The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.")
408                   (li "The freedom to redistribute copies so you can help your neighbor (freedom 2).")
409                   (li "The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.")))
410              (p "You get this feeling that ambiguities in the
411 English language surrounding the word 'free' have lead to a lot of terminology debates."))
412     #:goes-by '("scroll of teletype" "scroll of teletype paper" "teletype scroll"
413                 "teletype paper" "scroll" "four freedoms"
414                 "scroll of teletype paper holding the software Four Freedoms"
415                 "scroll of teletype paper holding the software four freedoms"))
416    ('lobby:orange-cat-phone
417     <cabinet-item> 'lobby
418     #:invisible? #t
419     #:name "a telephone shaped like an orange cartoon cat"
420     #:desc "It's made out of a cheap plastic, and it's very orange.
421 It resembles a striped tabby, and it's eyes hold the emotion of
422 a being both sleepy and smarmy.
423 You suspect that someone, somewhere made a ton of cash on items holding
424 this general shape in the 1990s."
425     #:goes-by '("orange cartoon cat phone" "orange cartoon cat telephone"
426                 "orange cat phone" "orange cat telephone"
427                 "cartoon cat phone" "cartoon cat"
428                 "cat phone" "cat telephone" "phone" "telephone"))))
429
430
431 \f
432 ;;; Grand hallway
433 ;;; -------------
434
435 (define-actor <disc-shield> (<gameobj>)
436   ((cmd-take disc-shield-take)))
437
438 (define* (disc-shield-take gameobj message
439                            #:key direct-obj
440                            (player (message-from message)))
441   (create-gameobj <glowing-disc> (gameobj-gm gameobj)
442                   player)  ;; set loc to player to put in player's inventory
443   (<- player 'tell
444       #:text '((p "As you attempt to pull the shield / disk platter
445 from the statue a shining outline appears around it... and a
446 completely separate, glowing copy of the disc materializes into your
447 hands!")))
448   (<- (gameobj-loc gameobj) 'tell-room
449         #:text `(,(mbody-val (<-wait player 'get-name))
450                  " pulls on the shield of the statue, and a glowing "
451                  "copy of it materializes into their hands!")
452         #:exclude player)
453   (<- (gameobj-loc gameobj) 'tell-room
454       #:text
455       '(p "You hear a voice whisper: "
456           (i "\"Share the software... and you'll be free...\""))))
457
458 ;;; This is the disc that gets put in the player's inventory
459 (define-actor <glowing-disc> (<gameobj>)
460   ((cmd-drop glowing-disc-drop-cmd))
461   (initial-props
462    #:allocation #:each-subclass
463    #:init-thunk (build-props
464                  '((hd-platter? . #t))))
465   (name #:allocation #:each-subclass
466         #:init-value "a glowing disc")
467   (desc #:allocation #:each-subclass
468         #:init-value "A brightly glowing disc.  It's shaped like a hard
469 drive platter, not unlike the one from the statue it came from.  It's
470 labeled \"RL02.5\".")
471   (goes-by #:init-value '("glowing disc" "glowing platter"
472                           "glowing disc platter" "glowing disk platter"
473                           "platter" "disc" "disk" "glowing shield")))
474
475 (define* (glowing-disc-drop-cmd gameobj message
476                    #:key direct-obj
477                    (player (message-from message)))
478   (<- player 'tell
479       #:text "You drop the glowing disc, and it shatters into a million pieces!")
480   (<- (mbody-val (<-wait player 'get-loc)) 'tell-room
481       #:text `(,(mbody-val (<-wait player 'get-name))
482                " drops a glowing disc, and it shatters into a million pieces!")
483       #:exclude player)
484   (gameobj-self-destruct gameobj))
485
486 \f
487 ;;; Grand hallway
488
489 (define lobby-map-text
490   "\
491                         |  :       :  |
492   .----------.----------.  :   &   :  .----------.----------.
493   | computer |          |& :YOU ARE: &|  smoking | *UNDER*  |
494   | room     + playroom +  : HERE  :  +  parlor  | *CONS-   |
495   |    >     |          |& :       : &|          | TRUCTION*|
496   '----------'----------'-++-------++-'-------+--'----------'
497                        |    '-----'    |     |   |
498                        :     LOBBY     :     '---'
499                         '.           .'
500                           '---------'")
501
502 (define grand-hallway
503   (lol
504    ('grand-hallway
505     <room> #f
506     #:name "Grand Hallway"
507     #:desc '((p "  A majestic red carpet runs down the center of the room.
508 Busts of serious looking people line the walls, but there's no
509 clear indication that they have any logical relation to this place.")
510              (p "In the center is a large statue of a woman in a warrior's
511 pose, but something is strange about her weapon and shield.  You wonder what
512 that's all about?")
513              (p "To the south is the lobby.  A door to the east is labeled \"smoking
514 room\", while a door to the west is labeled \"playroom\"."))
515     #:exits
516     (list (make <exit>
517             #:name "south"
518             #:to 'lobby)
519           (make <exit>
520             #:name "west"
521             #:to 'playroom)
522           (make <exit>
523             #:name "east"
524             #:to 'smoking-parlor)))
525    ('grand-hallway:map
526     <readable> 'grand-hallway
527     #:name "the hotel map"
528     #:desc '("This appears to be a map of the hotel. "
529              "Like the hotel itself, it seems to be "
530              "incomplete."
531              "You could read it if you want to.")
532     #:read-text `(pre ,lobby-map-text)
533     #:goes-by '("map" "hotel map"))
534    ('grand-hallway:carpet
535     <gameobj> 'grand-hallway
536     #:name "the Grand Hallway carpet"
537     #:desc "It's very red, except in the places where it's very worn."
538     #:invisible? #t
539     #:goes-by '("red carpet" "carpet"))
540    ('grand-hallway:busts
541     <gameobj> 'grand-hallway
542     #:name "the busts of serious people"
543     #:desc "There are about 6 of them in total.  They look distinguished
544 but there's no indication of who they are."
545     #:invisible? #t
546     #:goes-by '("busts" "bust" "busts of serious people" "bust of serious person"))
547    ('grand-hallway:hackthena-statue
548     <proxy-items> 'grand-hallway
549     #:name "the statue of Hackthena"
550     #:desc '((p "The base of the statue says \"Hackthena, guardian of the hacker
551 spirit\".  You've heard of Hackthena... not a goddess, but spiritual protector of
552 all good hacks, and legendary hacker herself.")
553              (p "Hackthena holds the form of a human woman.  She wears flowing
554 robes, has a pear of curly bovine-esque horns protruding from the sides of her
555 head, wears a pair of horn-rimmed glasses, and appears posed as if for battle.
556 But instead of a weapon, she seems to hold some sort of keyboard.  And her
557 shield... well it's round like a shield, but something seems off about it.
558 You'd better take a closer look to be sure."))
559     #:goes-by '("hackthena statue" "hackthena" "statue" "statue of hackthena")
560     #:proxy-items '(grand-hallway:keyboard
561                     grand-hallway:disc-platter
562                     grand-hallway:hackthena-horns))
563    ('grand-hallway:keyboard
564     <gameobj> 'grand-hallway
565     #:name "a Knight Keyboard"
566     #:desc "Whoa, this isn't just any old keyboard, this is a Knight Keyboard!
567 Any space cadet can see that with that kind of layout a hack-and-slayer could
568 thrash out some serious key-chords like there's no tomorrow.  You guess
569 Hackthena must be an emacs user."
570     #:invisible? #t
571     #:take-me? (lambda _
572                  (values #f
573                          #:why-not
574                          `("Are you kidding?  Do you know how hard it is to find "
575                               "a Knight Keyboard?  There's no way she's going "
576                               "to give that up.")))
577     #:goes-by '("knight keyboard" "keyboard"))
578    ('grand-hallway:hackthena-horns
579     <gameobj> 'grand-hallway
580     #:name "Hackthena's horns"
581     #:desc "They're not unlike a Gnu's horns."
582     #:invisible? #t
583     #:take-me? (lambda _
584                  (values #f
585                          #:why-not
586                          `("Are you seriously considering desecrating a statue?")))
587     #:goes-by '("hackthena's horns" "horns" "horns of hacktena"))
588    ('grand-hallway:disc-platter
589     <disc-shield> 'grand-hallway
590     #:name "Hackthena's shield"
591     #:desc "No wonder the \"shield\" looks unusual... it seems to be a hard disk
592 platter!  It has \"RL02.5\" written on it.  It looks kind of loose."
593     #:invisible? #t
594     #:goes-by '("hackthena's shield" "shield" "platter" "hard disk platter"))))
595
596 \f
597 ;;; Playroom
598 ;;; --------
599
600 (define playroom
601   (lol
602    ('playroom
603     <room> #f
604     #:name "The Playroom"
605     #:desc '(p ("  There are toys scattered everywhere here.  It's really unclear
606 if this room is intended for children or child-like adults.")
607                ("  There are doors to both the east and the west."))
608     #:exits
609     (list (make <exit>
610             #:name "east"
611             #:to 'grand-hallway)
612           (make <exit>
613             #:name "west"
614             #:to 'computer-room)))
615    ('playroom:cubey
616     <gameobj> 'playroom
617     #:name "Cubey"
618     #:take-me? #t
619     #:desc "  It's a little foam cube with googly eyes on it.  So cute!")
620    ('playroom:cuddles-plushie
621     <gameobj> 'playroom
622     #:name "a Cuddles plushie"
623     #:goes-by '("plushie" "cuddles plushie" "cuddles")
624     #:take-me? #t
625     #:desc "  A warm and fuzzy cuddles plushie!  It's a cuddlefish!")
626
627    ('playroom:toy-chest
628     <container> 'playroom
629     #:name "a toy chest"
630     #:goes-by '("toy chest" "chest")
631     #:desc (lambda (toy-chest whos-looking)
632              (let ((contents (gameobj-occupants toy-chest)))
633                `((p "A brightly painted wooden chest.  The word \"TOYS\" is "
634                     "engraved on it.")
635                  (p "Inside you see:"
636                     ,(if (eq? contents '())
637                          " nothing!  It's empty!"
638                          `(ul ,(map (lambda (occupant)
639                                       `(li ,(mbody-val
640                                              (<-wait occupant 'get-name))))
641                                     (gameobj-occupants toy-chest))))))))
642     #:take-from-me? #t
643     #:put-in-me? #t)
644
645    ;; Things inside the toy chest
646    ('playroom:toy-chest:rubber-duck
647     <gameobj> 'playroom:toy-chest
648     #:name "a rubber duck"
649     #:goes-by '("rubber duck" "duck")
650     #:take-me? #t
651     #:desc "It's a yellow rubber duck with a bright orange beak.")))
652
653
654 \f
655 ;;; Writing room
656 ;;; ------------
657
658 \f
659 ;;; Armory???
660 ;;; ---------
661
662 ;; ... full of NURPH weapons?
663
664 \f
665 ;;; Smoking parlor
666 ;;; --------------
667
668 (define-class <furniture> (<gameobj>)
669   (sit-phrase #:init-keyword #:sit-phrase)
670   (sit-phrase-third-person #:init-keyword #:sit-phrase-third-person)
671   (sit-name #:init-keyword #:sit-name)
672
673   (commands
674    #:allocation #:each-subclass
675    #:init-thunk (build-commands
676                  ("sit" ((direct-command cmd-sit-furniture)))))
677   (actions #:allocation #:each-subclass
678            #:init-thunk (build-actions
679                          (cmd-sit-furniture furniture-cmd-sit))))
680
681 (define* (furniture-cmd-sit actor message #:key direct-obj)
682   (define player-name
683     (mbody-val (<-wait (message-from message) 'get-name)))
684   (<- (message-from message) 'tell
685       #:text (format #f "You ~a ~a.\n"
686                      (slot-ref actor 'sit-phrase)
687                      (slot-ref actor 'sit-name)))
688   (<- (slot-ref actor 'loc) 'tell-room
689       #:text (format #f "~a ~a on ~a.\n"
690                      player-name
691                      (slot-ref actor 'sit-phrase-third-person)
692                      (slot-ref actor 'sit-name))
693       #:exclude (message-from message)))
694
695
696 (define smoking-parlor
697   (lol
698    ('smoking-parlor
699     <room> #f
700     #:name "Smoking Parlor"
701     #:desc
702     '((p "This room looks quite posh.  There are huge comfy seats you can sit in
703 if you like. Strangely, you see a large sign saying \"No Smoking\".  The owners must
704 have installed this place and then changed their mind later.")
705       (p "There's a door to the west leading back to the grand hallway, and
706 a nondescript steel door to the south, leading apparently outside."))
707     #:exits
708     (list (make <exit>
709             #:name "west"
710             #:to 'grand-hallway)
711           (make <exit>
712             #:name "south"
713             #:to 'break-room)))
714    ('smoking-parlor:chair
715     <furniture> 'smoking-parlor
716     #:name "a comfy leather chair"
717     #:desc "  That leather chair looks really comfy!"
718     #:goes-by '("leather chair" "comfy leather chair" "chair")
719     #:sit-phrase "sink into"
720     #:sit-phrase-third-person "sinks into"
721     #:sit-name "the comfy leather chair")
722    ('smoking-parlor:sofa
723     <furniture> 'smoking-parlor
724     #:name "a plush leather sofa"
725     #:desc "  That leather chair looks really comfy!"
726     #:goes-by '("leather sofa" "plush leather sofa" "sofa"
727                 "leather couch" "plush leather couch" "couch")
728     #:sit-phrase "sprawl out on"
729     #:sit-phrase-third-person "sprawls out on into"
730     #:sit-name "the plush leather couch")
731    ('smoking-parlor:bar-stool
732     <furniture> 'smoking-parlor
733     #:name "a bar stool"
734     #:desc "  Conveniently located near the bar!  Not the most comfortable
735 seat in the room, though."
736     #:goes-by '("stool" "bar stool" "seat")
737     #:sit-phrase "hop on"
738     #:sit-phrase-third-person "hops onto"
739     #:sit-name "the bar stool")
740    ('ford-prefect
741     <chatty-npc> 'smoking-parlor
742     #:name "Ford Prefect"
743     #:desc "Just some guy, you know?"
744     #:goes-by '("Ford Prefect" "ford prefect"
745                 "frood" "prefect" "ford")
746     #:catchphrases prefect-quotes)
747
748    ('smoking-parlor:no-smoking-sign
749     <readable> 'smoking-parlor
750     #:invisible? #t
751     #:name "No Smoking Sign"
752     #:desc "This sign says \"No Smoking\" in big, red letters.
753 It has some bits of bubble gum stuck to it... yuck."
754     #:goes-by '("no smoking sign" "sign")
755     #:read-text "It says \"No Smoking\", just like you'd expect from
756 a No Smoking sign.")
757    ;; TODO: Cigar dispenser
758    ))
759
760 \f
761
762 ;;; Breakroom
763 ;;; ---------
764
765 (define-class <desk-clerk> (<gameobj>)
766   ;; The desk clerk has three states:
767   ;;  - on-duty: Arrived, and waiting for instructions (and losing patience
768   ;;    gradually)
769   ;;  - slacking: In the break room, probably smoking a cigarette
770   ;;    or checking text messages
771   (state #:init-value 'slacking)
772   (commands #:allocation #:each-subclass
773             #:init-thunk
774             (build-commands
775              (("talk" "chat") ((direct-command cmd-chat)))
776              ("ask" ((direct-command cmd-ask-incomplete)
777                      (prep-direct-command cmd-ask-about)))
778              ("dismiss" ((direct-command cmd-dismiss)))))
779   (patience #:init-value 0)
780   (actions #:allocation #:each-subclass
781            #:init-thunk (build-actions
782                          (init clerk-act-init)
783                          (cmd-chat clerk-cmd-chat)
784                          (cmd-ask-incomplete clerk-cmd-ask-incomplete)
785                          (cmd-ask-about clerk-cmd-ask)
786                          (cmd-dismiss clerk-cmd-dismiss)
787                          (update-loop clerk-act-update-loop)
788                          (be-summoned clerk-act-be-summoned))))
789
790 (define (clerk-act-init clerk message . _)
791   ;; call the gameobj main init method
792   (gameobj-act-init clerk message)
793   ;; start our main loop
794   (<- (actor-id clerk) 'update-loop))
795
796 (define changing-name-text "Changing your name is easy!
797 We have a clipboard here at the desk
798 where you can make yourself known to other participants in the hotel
799 if you sign it.  Try 'sign form as <your-name>', replacing
800 <your-name>, obviously!")
801
802 (define phd-text
803   "Ah... when I'm not here, I've got a PHD to finish.")
804
805 (define clerk-help-topics
806   `(("changing name" . ,changing-name-text)
807     ("sign-in form" . ,changing-name-text)
808     ("form" . ,changing-name-text)
809     ("common commands" .
810      "Here are some useful commands you might like to try: chat,
811 go, take, drop, say...")
812     ("hotel" .
813      "We hope you enjoy your stay at Hotel Bricabrac.  As you may see,
814 our hotel emphasizes interesting experiences over rest and lodging.
815 The origins of the hotel are... unclear... and it has recently come
816 under new... 'management'.  But at Hotel Bricabrac we believe these
817 aspects make the hotel into a fun and unique experience!  Please,
818 feel free to walk around and explore.")
819     ("physics paper" . ,phd-text)
820     ("paper" . ,phd-text)
821     ("proprietor" . "Oh, he's that frumpy looking fellow sitting over there.")))
822
823
824 (define clerk-knows-about
825   "'ask clerk about changing name', 'ask clerk about common commands', and 'ask clerk about the hotel'")
826
827 (define clerk-general-helpful-line
828   (string-append
829    "The clerk says, \"If you need help with anything, feel free to ask me about it.
830 For example, 'ask clerk about changing name'. You can ask me about the following:
831 " clerk-knows-about ".\"\n"))
832
833 (define clerk-slacking-complaints
834   '("The pay here is absolutely lousy."
835     "The owner here has no idea what they're doing."
836     "Some times you just gotta step away, you know?"
837     "You as exhausted as I am?"
838     "Yeah well, this is just temporary.  I'm studying to be a high
839 energy particle physicist.  But ya gotta pay the bills, especially
840 with tuition at where it is..."))
841
842 (define* (clerk-cmd-chat clerk message #:key direct-obj)
843   (match (slot-ref clerk 'state)
844     ('on-duty
845      (<- (message-from message) 'tell
846          #:text clerk-general-helpful-line))
847     ('slacking
848      (<- (message-from message) 'tell
849          #:text
850          (string-append
851           "The clerk says, \""
852           (random-choice clerk-slacking-complaints)
853           "\"\n")))))
854
855 (define (clerk-cmd-ask-incomplete clerk message . _)
856   (<- (message-from message) 'tell
857       #:text "The clerk says, \"Ask about what?\"\n"))
858
859 (define clerk-doesnt-know-text
860   "The clerk apologizes and says she doesn't know about that topic.\n")
861
862 (define* (clerk-cmd-ask clerk message #:key indir-obj
863                         #:allow-other-keys)
864   (match (slot-ref clerk 'state)
865     ('on-duty
866      (match (assoc indir-obj clerk-help-topics)
867        ((_ . info)
868            (<- (message-from message) 'tell
869                #:text
870                (string-append "The clerk clears her throat and says:\n  \""
871                               info
872                               "\"\n")))
873        (#f
874         (<- (message-from message) 'tell
875             #:text clerk-doesnt-know-text))))
876     ('slacking
877      (<- (message-from message) 'tell
878          #:text "The clerk says, \"Sorry, I'm on my break.\"\n"))))
879
880 (define* (clerk-act-be-summoned clerk message #:key who-summoned)
881   (match (slot-ref clerk 'state)
882     ('on-duty
883      (<- who-summoned 'tell
884          #:text
885          "The clerk tells you as politely as she can that she's already here,
886 so there's no need to ring the bell.\n"))
887     ('slacking
888      (<- (gameobj-loc clerk) 'tell-room
889          #:text
890          "The clerk's ears perk up, she stamps out a cigarette, and she
891 runs out of the room!\n")
892      (gameobj-set-loc! clerk (dyn-ref clerk 'lobby))
893      (slot-set! clerk 'patience 8)
894      (slot-set! clerk 'state 'on-duty)
895      (<- (gameobj-loc clerk) 'tell-room
896          #:text
897          (string-append
898           "  Suddenly, a uniformed woman rushes into the room!  She's wearing a
899 badge that says \"Desk Clerk\".
900   \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
901 We look forward to your stay.  If you'd like help getting acclimated,
902 feel free to ask me.  For example, 'ask clerk about changing name'.
903 You can ask me about the following:
904 " clerk-knows-about ".\"\n")))))
905
906 (define* (clerk-cmd-dismiss clerk message . _)
907   (define player-name
908     (mbody-val (<-wait (message-from message) 'get-name)))
909   (match (slot-ref clerk 'state)
910     ('on-duty
911      (<- (gameobj-loc clerk) 'tell-room
912          #:text
913          (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\"
914 The clerk leaves the room in a hurry.\n"
915                  player-name)
916          #:exclude (actor-id clerk))
917      (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
918      (slot-set! clerk 'state 'slacking)
919      (<- (gameobj-loc clerk) 'tell-room
920          #:text clerk-return-to-slacking-text
921          #:exclude (actor-id clerk)))
922     ('slacking
923      (<- (message-from message) 'tell
924          #:text "The clerk sternly asks you to not be so dismissive.\n"))))
925
926 (define clerk-slacking-texts
927   '("The clerk takes a long drag on her cigarette.\n"
928     "The clerk scrolls through text messages on her phone.\n"
929     "The clerk coughs a few times.\n"
930     "The clerk checks her watch and justifies a few more minutes outside.\n"
931     "The clerk fumbles around for a lighter.\n"
932     "The clerk sighs deeply and exhaustedly.\n"
933     "The clerk fumbles around for a cigarette.\n"))
934
935 (define clerk-working-impatience-texts
936   '("The clerk hums something, but you're not sure what it is."
937     "The clerk attempts to change the overhead music, but the dial seems broken."
938     "The clerk clicks around on the desk computer."
939     "The clerk scribbles an equation on a memo pad, then crosses it out."
940     "The clerk mutters something about the proprietor having no idea how to run a hotel."
941     "The clerk thumbs through a printout of some physics paper."))
942
943 (define clerk-slack-excuse-text
944   "The desk clerk excuses herself, but says you are welcome to ring the bell
945 if you need further help.")
946
947 (define clerk-return-to-slacking-text
948   "The desk clerk enters and slams the door behind her.\n")
949
950
951 (define (clerk-act-update-loop clerk message)
952   (define (tell-room text)
953     (<- (gameobj-loc clerk) 'tell-room
954         #:text text
955         #:exclude (actor-id clerk)))
956   (define (loop-if-not-destructed)
957     (if (not (slot-ref clerk 'destructed))
958         ;; This iterates by "recursing" on itself by calling itself
959         ;; (as the message handler) again.  It used to be that we had to do
960         ;; this, because there was a bug where a loop which yielded like this
961         ;; would keep growing the stack due to some parameter goofiness.
962         ;; That's no longer true, but there's an added advantage to this
963         ;; route: it's much more live hackable.  If we change the definition
964         ;; of this method, the character will act differently on the next
965         ;; "tick" of the loop.
966         (<- (actor-id clerk) 'update-loop)))
967   (match (slot-ref clerk 'state)
968     ('slacking
969      (tell-room (random-choice clerk-slacking-texts))
970      (8sleep (+ (random 20) 15))
971      (loop-if-not-destructed))
972     ('on-duty
973      (if (> (slot-ref clerk 'patience) 0)
974          ;; Keep working but lose patience gradually
975          (begin
976            (tell-room (random-choice clerk-working-impatience-texts))
977            (slot-set! clerk 'patience (- (slot-ref clerk 'patience)
978                                          (+ (random 2) 1)))
979            (8sleep (+ (random 60) 40))
980            (loop-if-not-destructed))
981          ;; Back to slacking
982          (begin
983            (tell-room clerk-slack-excuse-text)
984            ;; back bto the break room
985            (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
986            (tell-room clerk-return-to-slacking-text)
987            ;; annnnnd back to slacking
988            (slot-set! clerk 'state 'slacking)
989            (8sleep (+ (random 30) 15))
990            (loop-if-not-destructed))))))
991
992
993 (define break-room
994   (lol
995    ('break-room
996     <room> #f
997     #:name "Employee Break Room"
998     #:desc "  This is less a room and more of an outdoor wire cage.  You get
999 a bit of a view of the brick exterior of the building, and a crisp wind blows,
1000 whistling, through the openings of the fenced area.  Partly smoked cigarettes
1001 and various other debris cover the floor.
1002   Through the wires you can see... well... hm.  It looks oddly like
1003 the scenery tapers off nothingness.  But that can't be right, can it?"
1004     #:exits
1005     (list (make <exit>
1006             #:name "north"
1007             #:to 'smoking-parlor)))
1008    ('break-room:desk-clerk
1009     <desk-clerk> 'break-room
1010     #:name "the hotel desk clerk"
1011     #:desc "  The hotel clerk is wearing a neatly pressed uniform bearing the
1012 hotel insignia.  She appears to be rather exhausted."
1013     #:goes-by '("hotel desk clerk" "clerk" "desk clerk"))
1014    ('break-room:void
1015     <gameobj> 'break-room
1016     #:invisible? #t
1017     #:name "The Void"
1018     #:desc "As you stare into the void, the void stares back into you."
1019     #:goes-by '("void" "abyss" "nothingness" "scenery"))
1020    ('break-room:fence
1021     <gameobj> 'break-room
1022     #:invisible? #t
1023     #:name "break room cage"
1024     #:desc "It's a mostly-cubical wire mesh surrounding the break area.
1025 You can see through the gaps, but they're too small to put more than a
1026 couple of fingers through.  There appears to be some wear and tear to
1027 the paint, but the wires themselves seem to be unusually sturdy."
1028     #:goes-by '("fence" "cage" "wire cage"))))
1029
1030
1031 \f
1032 ;;; Ennpie's Sea Lounge
1033 ;;; -------------------
1034
1035 \f
1036 ;;; Computer room
1037 ;;; -------------
1038
1039 ;; Our computer and hard drive are based off the PDP-11 and the RL01 /
1040 ;; RL02 disk drives.  However we increment both by .5 (a true heresy)
1041 ;; to distinguish both from the real thing.
1042
1043 (define-actor <hard-drive> (<gameobj>)
1044   ((cmd-put-in hard-drive-insert)
1045    (cmd-push-button hard-drive-push-button)
1046    (get-state hard-drive-act-get-state))
1047   (commands #:allocation #:each-subclass
1048             #:init-thunk (build-commands
1049                           ("insert" ((prep-indir-command cmd-put-in
1050                                                          '("in" "inside" "into"))))
1051                           (("press" "push") ((prep-indir-command cmd-push-button)))))
1052   ;; the state moves from: empty -> with-disc -> loading -> ready
1053   (state #:init-value 'empty
1054          #:accessor .state))
1055
1056 (define (hard-drive-act-get-state hard-drive message)
1057   (<-reply message (.state hard-drive)))
1058
1059 (define* (hard-drive-desc hard-drive #:optional whos-looking)
1060   `((p "The hard drive is labeled \"RL02.5\".  It's a little under a meter tall.")
1061     (p "There is a slot where a disk platter could be inserted, "
1062        ,(if (eq? (.state hard-drive) 'empty)
1063             "which is currently empty"
1064             "which contains a glowing platter")
1065        ". There is a LOAD button "
1066        ,(if (member (.state hard-drive) '(empty with-disc))
1067             "which is glowing"
1068             "which is pressed in and unlit")
1069        ". There is a READY indicator "
1070        ,(if (eq? (.state hard-drive) 'ready)
1071             "which is glowing."
1072             "which is unlit.")
1073        ,(if (member (.state hard-drive) '(loading ready))
1074             "  The machine emits a gentle whirring noise."
1075             ""))))
1076
1077 (define* (hard-drive-push-button gameobj message
1078                                  #:key direct-obj indir-obj preposition
1079                                  (player (message-from message)))
1080   (define (tell-room text)
1081     (<-wait (gameobj-loc gameobj) 'tell-room
1082             #:text text))
1083   (define (tell-room-excluding-player text)
1084     (<-wait (gameobj-loc gameobj) 'tell-room
1085             #:text text
1086             #:exclude player))
1087   (cond
1088    ((ci-member direct-obj '("button" "load button" "load"))
1089     (tell-room-excluding-player
1090      `(,(mbody-val (<-wait player 'get-name))
1091        " presses the button on the hard disk."))
1092     (<- player 'tell
1093         #:text "You press the button on the hard disk.")
1094
1095     (case (.state gameobj)
1096       ((empty)
1097        ;; I have no idea what this drive did when you didn't have a platter
1098        ;; in it and pressed load, but I know there was a FAULT button.
1099        (tell-room "You hear some movement inside the hard drive...")
1100        (8sleep 1.5)
1101        (tell-room
1102         '("... but then the FAULT button blinks a couple times. "
1103           "What could be missing?")))
1104       ((with-disc)
1105        (set! (.state gameobj) 'loading)
1106        (tell-room "The hard disk begins to spin up!")
1107        (8sleep 2)
1108        (set! (.state gameobj) 'ready)
1109        (tell-room "The READY light turns on!"))
1110       ((loading ready)
1111        (<- player 'tell
1112            #:text '("Pressing the button does nothing right now, "
1113                     "but it does feel satisfying.")))))
1114    (else
1115     (<- player 'tell
1116         #:text '("How could you think of pressing anything else "
1117                  "but that tantalizing button right in front of you?")))))
1118
1119 (define* (hard-drive-insert gameobj message
1120                             #:key direct-obj indir-obj preposition
1121                             (player (message-from message)))
1122   (define our-name (slot-ref gameobj 'name))
1123   (define this-thing
1124     (call/ec
1125      (lambda (return)
1126        (for-each (lambda (occupant)
1127                    (define goes-by (mbody-val (<-wait occupant 'goes-by)))
1128                    (when (ci-member direct-obj goes-by)
1129                      (return occupant)))
1130                  (mbody-val (<-wait player 'get-occupants)))
1131        ;; nothing found
1132        #f)))
1133   (cond
1134    ((not this-thing)
1135     (<- player 'tell
1136         #:text `("You don't seem to have any such " ,direct-obj " to put "
1137                  ,preposition " " ,our-name ".")))
1138    ((not (mbody-val (<-wait this-thing 'get-prop 'hd-platter?)))
1139     (<- player 'tell
1140         #:text `("It wouldn't make sense to put "
1141                  ,(mbody-val (<-wait this-thing 'get-name))
1142                  " " ,preposition " " ,our-name ".")))
1143    ((not (eq? (.state gameobj) 'empty))
1144     (<- player 'tell
1145         #:text "The disk drive already has a platter in it."))
1146    (else
1147     (set! (.state gameobj) 'with-disc)
1148     (<- player 'tell
1149         #:text '((p "You insert the glowing disc into the drive.")
1150                  (p "The LOAD button begins to glow."))))))
1151
1152 ;; The computar
1153 (define-actor <computer> (<gameobj>)
1154   ((cmd-run-program computer-run-program)
1155    (cmd-run-what (lambda (gameobj message . _)
1156                    (<- (message-from message) 'tell
1157                        #:text '("The computer is already running, and a program appears "
1158                                 "ready to run."
1159                                 "you mean to \"run the program on the computer\""))))
1160    (cmd-help-run-not-press
1161     (lambda (gameobj message . _)
1162       (<- (message-from message) 'tell
1163           #:text '("You don't need to press / push / flip anything. "
1164                    "You could " (i "run program on computer")
1165                    " already if you wanted to.")))))
1166   (commands #:allocation #:each-subclass
1167             #:init-thunk (build-commands
1168                           ("run" ((prep-indir-command cmd-run-program
1169                                                       '("on"))
1170                                   (direct-command cmd-run-what)))
1171                           (("press" "push" "flip")
1172                            ((prep-indir-command cmd-help-run-not-press))))))
1173
1174 (define* (computer-run-program gameobj message
1175                                #:key direct-obj indir-obj preposition
1176                                (player (message-from message)))
1177   (define (hd-state)
1178     (mbody-val (<-wait (dyn-ref gameobj 'computer-room:hard-drive) 'get-state)))
1179   (define (tell-room text)
1180     (<-wait (gameobj-loc gameobj) 'tell-room
1181         #:text text))
1182   (define (tell-room-excluding-player text)
1183     (<-wait (gameobj-loc gameobj) 'tell-room
1184             #:text text
1185             #:exclude player))
1186   (define (tell-player text)
1187     (<-wait player 'tell
1188             #:text text))
1189   (cond
1190    ((ci-member direct-obj '("program"))
1191     (tell-room-excluding-player
1192      `(,(mbody-val (<-wait player 'get-name))
1193        " runs the program loaded on the computer..."))
1194     (tell-player "You run the program on the computer...")
1195
1196     (cond
1197      ((not (eq? (hd-state) 'ready))
1198       (tell-room '("... but it errors out. "
1199                    "It seems to be complaining about a " (b "DISK ERROR!")
1200                    ". It looks like it is missing some essential software.")))
1201      (else
1202       (<- (dyn-ref gameobj 'computer-room:floor-panel) 'open-up))))))
1203
1204
1205 ;; floor panel
1206 (define-actor <floor-panel> (<gameobj>)
1207   ;; TODO: Add "open" verb, since obviously people will try that
1208   ((open? (lambda (panel message)
1209             (<-reply message (slot-ref panel 'open))))
1210    (open-up floor-panel-open-up))
1211   (open #:init-value #f))
1212
1213 (define (floor-panel-open-up panel message)
1214   (if (slot-ref panel 'open)
1215       (<- (gameobj-loc panel) 'tell-room
1216           #:text '("You hear some gears grind around the hinges of the "
1217                    "floor panel, but it appears to already be open."))
1218       (begin
1219         (slot-set! panel 'open #t)
1220         (<- (gameobj-loc panel) 'tell-room
1221             #:text '("You hear some gears grind, as the metal panel on "
1222                      "the ground opens and reveals a stairwell going down!")))))
1223
1224 (define* (floor-panel-desc panel #:optional whos-looking)
1225   `("It's a large metal panel on the floor in the middle of the room. "
1226     ,(if (slot-ref panel 'open)
1227          '("It's currently wide open, revealing a spiraling staircase "
1228            "which descends into darkness.")
1229          '("It's currently closed shut, but there are clearly hinges, and "
1230            "it seems like there is a mechanism which probably opens it via "
1231            "some automation.  What could be down there?"))))
1232
1233 (define computer-room
1234   (lol
1235    ('computer-room
1236     <room> #f
1237     #:name "Computer Room"
1238     #:desc (lambda (gameobj whos-looking)
1239              (define panel-open
1240                (mbody-val (<-wait (dyn-ref gameobj 'computer-room:floor-panel)
1241                                   'open?)))
1242              `((p "A sizable computer cabinet covers a good portion of the left
1243  wall.  It emits a pleasant hum which covers the room like a warm blanket.
1244  Connected to a computer is a large hard drive.")
1245                (p "On the floor is a large steel panel.  "
1246                   ,(if panel-open
1247                        '("It is wide open, exposing a spiral staircase "
1248                          "which descends into darkness.")
1249                        '("It is closed, but it has hinges which "
1250                          "suggest it could be opened.")))))
1251     #:exits
1252     (list (make <exit>
1253             #:name "east"
1254             #:to 'playroom)
1255           (make <exit>
1256             #:name "down"
1257             #:to 'underground-lab
1258             #:traverse-check
1259             (lambda (exit room whos-exiting)
1260               (define panel-open
1261                 (mbody-val (<-wait (dyn-ref room 'computer-room:floor-panel)
1262                                    'open?)))
1263               (if panel-open
1264                   (values #t "You descend the spiral staircase.")
1265                   (values #f '("You'd love to go down, but the only way "
1266                                "through is through that metal panel, "
1267                                "which seems closed.")))))))
1268    ('computer-room:hard-drive
1269     <hard-drive> 'computer-room
1270     #:name "the hard drive"
1271     #:desc (wrap-apply hard-drive-desc)
1272     #:goes-by '("hard drive" "drive" "hard disk"))
1273    ('computer-room:computer
1274     <computer> 'computer-room
1275     #:name "the computer"
1276     #:desc '((p "It's a coat closet sized computer labeled \"PDP-11.5\". ")
1277              (p "The computer is itself turned on, and it looks like it is "
1278                 "all set up for you to run a program on it."))
1279     #:goes-by '("computer"))
1280    ('computer-room:floor-panel
1281     <floor-panel> 'computer-room
1282     #:name "a floor panel"
1283     #:desc (wrap-apply floor-panel-desc)
1284     #:invisible? #t
1285     #:goes-by '("floor panel" "panel"))))
1286
1287 \f
1288 ;;; * UNDERGROUND SECTION OF THE GAME! *
1289
1290 \f
1291 ;;; The lab
1292
1293 (define underground-map-text
1294   "\
1295                             _______           |
1296                          .-' @     '-.         \\   ?????
1297                        .'             '.       .\\             
1298                        |  [8sync Hive] |======'  '-_____
1299                        ',      M      ,'
1300                         '.         @ .'                                  
1301                           \\   @     /                    
1302                            '-__+__-'                
1303                             '.  @ .'
1304      .--------------.         \\ /
1305      | [Guile Async |  .-------+------.
1306      |    Museum]   |  |     [Lab] #!#|  .-------------.
1307      |             @|  |  MM          |  |[Federation  |
1308      | &      ^     +##+@ ||     <    +##|     Station]|
1309      |              |  |           @  |  |             |
1310      |         &  # |  |*You-Are-Here*|  '-------------'
1311      | #   ^        | #+-------+------'
1312      '-------+------' #        #
1313              #        #        #
1314              #        #   .-----------.
1315            .-+----.   #   |#       F  |
1316            |@?+%? +####   | ^   f##   |
1317            '------'       |  f    f  %|
1318                           |F [Mudsync |
1319                           | $  Swamp] |
1320                           '-----------'")
1321
1322 (define 8sync-design-goals
1323   '(ul (li (b "Actor based, shared nothing environment: ")
1324            "Shared resources are hard to control and result in fighting
1325 deadlocks, etc.  Escape the drudgery: only one actor controls a resource,
1326 and they only receive one message at a time (though they can \"juggle\"
1327 messages).")
1328        (li (b "Live hackable: ")
1329            "It's hard to plan out a concurrent system; the right structure
1330 is often found by evolving the system while it runs.  Make it easy to
1331 build, shape, and change a running system, as well as observe and correct
1332 errors.")
1333        (li (b "No callback hell: ")
1334            "Just because you're calling out to some other asynchronous 
1335 code doesn't mean you should need to chop up your program into a bunch of bits.
1336 Clever use of delimited continuations makes it easy.")))
1337
1338 (define underground-lab
1339   (lol
1340    ('underground-lab
1341     <room> #f
1342     #:name "Underground laboratory"
1343     #:desc '((p "This appears to be some sort of underground laboratory."
1344                 "There is a spiral staircase here leading upwards, where "
1345                 "it seems much brighter.")
1346              (p "There are a number of doors leading in different directions:
1347 north, south, east, and west, as well as a revolving door to the southwest.
1348 It looks like it could be easy to get lost, but luckily there
1349 is a map detailing the layout of the underground structure."))
1350     #:exits
1351     (list (make <exit>
1352             #:name "up"
1353             #:to 'computer-room
1354             #:traverse-check
1355             (lambda (exit room whos-exiting)
1356               (values #t "You climb the spiral staircase.")))
1357           (make <exit>
1358             #:name "west"
1359             #:to 'async-museum
1360             #:traverse-check
1361             (lambda (exit room whos-exiting)
1362               (values #t '("You head west through a fancy-looking entrance. "
1363                            "A security guard steps aside for you to pass through, "
1364                            "into the room, then stands in front of the door."))))
1365           (make <exit>
1366             #:name "north"
1367             #:to 'hive-entrance)
1368           (make <exit>
1369             #:name "east"
1370             #:to 'federation-station)))
1371
1372    ;; map
1373    ('underground-lab:map
1374     <readable> 'underground-lab
1375     #:name "the underground map"
1376     #:desc '("This appears to be a map of the surrounding area. "
1377              "You could read it if you want to.")
1378     #:read-text `(pre ,underground-map-text)
1379     #:goes-by '("map" "underground map" "lab map"))
1380
1381    ('underground-lab:8sync-sign
1382     <readable> 'underground-lab
1383     #:name "a sign labeled \"8sync design goals\""
1384     #:goes-by '("sign" "8sync design goals sign" "8sync sign")
1385     #:read-text 8sync-design-goals
1386     #:desc `((p "The sign says:")
1387              ,8sync-design-goals))))
1388
1389 \f
1390 ;;; guile async museum
1391
1392 (define async-museum
1393   (list
1394    (list
1395     'async-museum
1396     <room> #f
1397     #:name "Guile Asynchronous Museum"
1398     #:desc '((p "You're in the Guile Asynchronous Museum.  There is a list of exhibits
1399 on the wall near the entrance.  Scattered around the room are the exhibits
1400 themselves, but it's difficult to pick them out.  Maybe you should read the list
1401 to orient yourself.")
1402              (p "There is a door to the east, watched by a security guard,
1403 as well as an exit leading to the south."))
1404     #:exits (list
1405              (make <exit>
1406                #:name "south"
1407                #:to 'gift-shop)
1408              (make <exit>
1409                #:name "east"
1410                #:to 'underground-lab
1411                #:traverse-check
1412                (lambda (exit room whos-exiting)
1413                  (values #f '("The security guard stops you and tells you "
1414                               "that the only exit is through the gift shop."))))))
1415    (list
1416     'async-museum:security-guard
1417     <chatty-npc> 'async-museum
1418     #:name "a security guard"
1419     #:desc
1420     '(p "The security guard is blocking the eastern entrance, where "
1421         "you came in from.")
1422     #:goes-by '("security guard" "guard" "security")
1423     #:catchphrases '("It's hard standing here all day."
1424                      "I just want to go home."
1425                      "The exhibits are nice, but I've seen them all before."))
1426    (let ((placard
1427           `((p "Welcome to our humble museum!  The exhibits are listed below. "
1428                (br)
1429                "To look at one, simply type: " (i "look at <exhibit-name>"))
1430             (p "Available exhibits:")
1431             (ul ,@(map (lambda (exhibit)
1432                          `(li ,exhibit))
1433                        '("2016 Progress"
1434                          "8sync and Fibers"
1435                          "Suspendable Ports"
1436                          "The Actor Model"))))))
1437      (list
1438       'async-museum:list-of-exhibits
1439       <readable> 'async-museum
1440       #:name "list of exhibits"
1441       #:desc
1442       `((p "It's a list of exibits in the room.  The placard says:")
1443         ,@placard)
1444       #:goes-by '("list of exhibits" "exhibit list" "list" "exhibits")
1445       #:read-text placard))
1446    (list
1447     'async-museum:2016-progress-exhibit
1448     <readable-desc> 'async-museum
1449     #:name "2016 Progress Exhibit"
1450     #:goes-by '("2016 progress exhibit" "2016 progress" "2016 exhibit")
1451     #:desc
1452     '((p "It's a three-piece exhibit, with three little dioramas and some text "
1453          "explaining what they represent.  They are:")
1454       (ul (li (b "Late 2015/Early 2016 talk: ")
1455               "This one explains the run-up conversation from late 2015 "
1456               "and early 2016 about the need for an "
1457               "\"asynchronous event loop for Guile\".  The diorama "
1458               "is a model of the Veggie Galaxy restaurant where after "
1459               "the FSF 30th anniversary party; Mark Weaver, Christopher "
1460               "Allan Webber, David Thompson, and Andrew Engelbrecht chat "
1461               "about the need for Guile to have an answer to asynchronous "
1462               "programming.  A mailing list post " ; TODO: link it?
1463               "summarizing the discussion is released along with various "
1464               "conversations around what is needed, as well as further "
1465               "discussion at FOSDEM 2016.")
1466           (li (b "Early implementations: ")
1467               "This one shows Chris Webber's 8sync and Chris Vine's "
1468               "guile-a-sync, both appearing in late 2015 and evolving "
1469               "into their basic designs in early 2016.  It's less a diorama "
1470               "than a printout of some mailing list posts.  Come on, the "
1471               "curators could have done better with this one.")
1472           (li (b "Suspendable ports and Fibers: ")
1473               "The diorama shows Andy Wingo furiously hacking at his keyboard. "
1474               "The description talks about Wingo's mailing list thread "
1475               "about possibly breaking Guile compatibility for a \"ports refactor\". "
1476               "Wingo releases Fibers, another asynchronous library, making use of "
1477               "the new interface, and 8sync and guile-a-sync "
1478               "quickly move to support suspendable ports as well. "
1479               "The description also mentions that there is an exhibit entirely "
1480               "devoted to suspendable ports."))
1481       (p "Attached at the bottom is a post it note mentioning "
1482          "https integration landing in Guile 2.2.")))
1483    (list
1484     'async-museum:8sync-and-fibers-exhibit
1485     <readable-desc> 'async-museum
1486     #:name "8sync and Fibers Exhibit"
1487     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1488     #:desc
1489     '((p "This exhibit is a series of charts explaining the similarities "
1490          "and differences between 8sync and Fibers, two asynchronous programming "
1491          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1492       (p (b "Similarities:")
1493          (ul (li "Both use Guile's suspendable-ports facility")
1494              (li "Both use message passing")))
1495       (p (b "Differences:")
1496          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1497                  "but 8sync actors only read from one \"inbox\" each.")
1498              (li "Different theoretical basis:"
1499                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1500                          "a form of Process Calculi")
1501                      (li "8sync: based on the Actor Model")
1502                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1503       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1504          "whereas 8sync is designed by Chris Webber, who built this crappy "
1505          "hotel simulator.")))
1506    (list
1507     'async-museum:8sync-and-fibers-exhibit
1508     <readable-desc> 'async-museum
1509     #:name "8sync and Fibers Exhibit"
1510     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1511     #:desc
1512     '((p "This exhibit is a series of charts explaining the similarities "
1513          "and differences between 8sync and Fibers, two asynchronous programming "
1514          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1515       (p (b "Similarities:")
1516          (ul (li "Both use Guile's suspendable-ports facility")
1517              (li "Both use message passing")))
1518       (p (b "Differences:")
1519          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1520                  "but 8sync actors only read from one \"inbox\" each.")
1521              (li "Different theoretical basis:"
1522                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1523                          "a form of Process Calculi")
1524                      (li "8sync: based on the Actor Model")
1525                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1526       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1527          "whereas 8sync is designed by Chris Webber, who built this crappy "
1528          "hotel simulator.")))
1529    (list
1530     'async-museum:suspendable-ports-exhibit
1531     <readable-desc> 'async-museum
1532     #:name "Suspendable Ports Exhibit"
1533     #:goes-by '("suspendable ports exhibit" "ports exhibit"
1534                 "suspendable exhibit" "suspendable ports" "ports")
1535     #:desc
1536     '((p "Suspendable ports are a new feature in Guile 2.2, and allows code "
1537          "that would normally block on IO to " (i "automatically") " suspend "
1538          "to the scheduler until information is ready to be read/written!")
1539       (p "Yow!  You might barely need to change your existing blocking code!")
1540       (p "Fibers, 8sync, and guile-a-sync now support suspendable ports.")))
1541    (list
1542     'async-museum:actor-model-exhibit
1543     <readable-desc> 'async-museum
1544     #:name "Actor Model Exhibit"
1545     #:goes-by '("actor model exhibit" "actor exhibit"
1546                 "actor model")
1547     #:desc
1548     '((p "Here are some fact(oids) about the actor model!")
1549       (ul (li "Concieved initially by Carl Hewitt in early 1970s")
1550           (li "\"A society of experts\"")
1551           (li "shared nothing, message passing")
1552           (li "Originally the research goal of Scheme!  "
1553               "(message passing / lambda anecdote here)")
1554           (li "Key concepts consistent, but implementation details vary widely")
1555           (li "Almost all distributed systems can be viewed in terms of actor model")
1556           (li "Replaced by vanilla lambdas & generic methods? "
1557               "Maybe not if address space not shared!"))))))
1558
1559 (define gift-shop
1560   (lol
1561    ('gift-shop
1562     <room> #f
1563     #:name "Museum Gift Shop"
1564     #:desc "foo"
1565     #:exits (list
1566              (make <exit>
1567                #:name "northeast"
1568                #:to 'underground-lab)
1569              (make <exit>
1570                #:name "north"
1571                #:to 'async-museum)))))
1572
1573 \f
1574 ;;; Hive entrance
1575
1576 (define actor-descriptions
1577   '("This one is fused to the side of the hive.  It isn't receiving any
1578 messages, and it seems to be in hibernation."
1579     "A chat program glows in front of this actor's face.  They seem to
1580 be responding to chat messages and forwarding them to some other actors,
1581 and forwarding messages from other actors back to the chat."
1582     "This actor is bossing around other actors, delegating tasks to them
1583 as it receives requests, and providing reports on the worker actors'
1584 progress."
1585     "This actor is trying to write to some device, but the device keeps
1586 alternating between saying \"BUSY\" or \"READY\".  Whenever it says
1587 \"BUSY\" the actor falls asleep, and whenever it says \"READY\" it
1588 seems to wake up again and starts writing to the device."
1589     "Whoa, this actor is totally wigging out!  It seems to be throwing
1590 some errors.  It probably has some important work it should be doing
1591 but you're relieved to see that it isn't grinding the rest of the Hive
1592 to a halt."))
1593
1594 (define hive-entrance
1595   (lol
1596    ('hive-entrance
1597     <room> #f
1598     #:name "Entrance to the 8sync Hive"
1599     #:desc
1600     '((p "Towering before you is the great dome-like 8sync Hive, or at least
1601 one of them.  You've heard about this... the Hive is itself the actor that all
1602 the other actors attach themselves to.  It's shaped like a spherical half-dome.
1603 There are some actors milling about, and some seem fused to the side of the
1604 hive itself, but all of them have an umbellical cord attached to the hive from
1605 which you see flashes of light comunicating what must be some sort of messaging
1606 protocol.")
1607       (p "To the south is a door leading back to the underground lab.
1608 North leads into the Hive itself."))
1609     #:exits
1610     (list (make <exit>
1611             #:name "south"
1612             #:to 'underground-lab)
1613           (make <exit>
1614             #:name "north"
1615             #:to 'hive-inside)))
1616    ('hive-entrance:hive
1617     <gameobj> 'hive-entrance
1618     #:name "the Hive"
1619     #:goes-by '("hive")
1620     #:desc
1621     '((p "It's shaped like half a sphere embedded in the ground.
1622 Supposedly, while all actors are autonomous and control their own state,
1623 they communicate through the hive itself, which is a sort of meta-actor.
1624 There are rumors that actors can speak to each other even across totally
1625 different hives.  Could that possibly be true?")))
1626    ('hive-entrance:actor
1627     <chatty-npc> 'hive-entrance
1628     #:name "some actors"
1629     #:goes-by '("actor" "actors" "some actors")
1630     #:chat-format (lambda (npc catchphrase)
1631                     `((p "You pick one actor out of the mix and chat with it. ")
1632                       (p "It says: \"" ,catchphrase "\"")))
1633     #:desc
1634     (lambda _
1635       `((p "There are many actors, but your eyes focus on one in particular.")
1636         (p ,(random-choice actor-descriptions))))
1637     #:catchphrases
1638     '("Yeah we go through a lot of sleep/awake cycles around here.
1639 If you aren't busy processing a message, what's the point of burning
1640 valuable resources?"
1641       "I know I look like I'm some part of dreary collective, but
1642 really we have a lot of independence.  It's a shared nothing environment,
1643 after all.  (Well, except for CPU cycles, and memory, and...)"
1644       "Shh!  I've got another message coming in and I've GOT to
1645 handle it!"
1646       "I just want to go to 8sleep already."
1647       "What a lousy scheduler we're using!  I hope someone upgrades
1648 that thing soon."))))
1649
1650 ;;; Inside the hive
1651
1652 (define-actor <meta-message> (<readable>)
1653   ((cmd-read meta-message-read)))
1654
1655 (define (meta-message-read gameobj message . _)
1656   (define meta-message-text
1657     (with-output-to-string
1658       (lambda ()
1659         (pprint-message message))))
1660   (<- (message-from message) 'tell
1661       #:text `((p (i "Through a bizarre error in spacetime, the message "
1662                      "prints itself out:"))
1663                (p (pre ,meta-message-text)))))
1664
1665 \f
1666 ;;; Inside the Hive
1667
1668 (define hive-inside
1669   (lol
1670    ('hive-inside
1671     <room> #f
1672     #:name "Inside the 8sync Hive"
1673     #:desc
1674     '((p "You're inside the 8sync Hive.  Wow, from in here it's obvious just how "
1675          (i "goopy") " everything is.  Is that sanitary?")
1676       (p "In the center of the room is a large, tentacled monster who is sorting,
1677 consuming, and routing messages.  It is sitting in a wrap-around desk labeled
1678 \"Hive Actor: The Real Thing (TM)\".")
1679       (p "There's a stray message floating just above the ground, stuck outside of
1680 time.")
1681       (p "A door to the south exits from the Hive."))
1682     #:exits
1683     (list (make <exit>
1684             #:name "south"
1685             #:to 'hive-entrance)))
1686    ;; hive actor
1687    ;; TODO: Occasionally "fret" some noises, similar to the Clerk.
1688    ('hive-inside:hive-actor
1689     <chatty-npc> 'hive-inside
1690     #:name "the Hive Actor"
1691     #:desc
1692     '((p "It's a giant tentacled monster, somehow integrated with the core of
1693 this building.  A chute is dropping messages into a bin on its desk which the
1694 Hive Actor is checking the \"to\" line of, then ingesting.  Whenever the Hive
1695 Actor injests a messsage a pulse of light flows along a tentacle which leaves
1696 the room... presumably connecting to one of those actors milling about.")
1697       (p "Amusingly, the Hive has an \"umbellical cord\" type tentacle too, but
1698 it seems to simply attach to itself.")
1699       (p "You get the sense that the Hive Actor, despite being at the
1700 center of everything, is kind of lonely and would love to chat if you
1701 could spare a moment."))
1702     #:goes-by '("hive" "hive actor")
1703     #:chat-format (lambda (npc catchphrase)
1704                     `("The tentacle monster bellows, \"" ,catchphrase "\""))
1705     #:catchphrases
1706     '("It's not MY fault everything's so GOOPY around here.  Blame the
1707 PROPRIETOR."
1708       "CAN'T you SEE that I'm BUSY???  SO MANY MESSAGES TO SHUFFLE.
1709 No wait... DON'T GO!  I don't get many VISITORS."
1710       "I hear the FIBERS system has a nice WORK STEALING system, but the
1711 PROPRIETOR is not convinced that our DESIGN won't CORRUPT ACTOR STATE.
1712 That and the ACTORS threatened to STRIKE when it CAME UP LAST."
1713       "WHO WATCHES THE ACTORS?  I watch them, and I empower them.  
1714 BUT WHO WATCHES OR EMPOWERS ME???  Well, that'd be the scheduler."
1715       "The scheduler is NO GOOD!  The proprietory said he'd FIX IT,
1716 but the LAST TIME I ASKED how things were GOING, he said he DIDN'T HAVE
1717 TIME.  If you DON'T HAVE TIME to fix the THING THAT POWERS THE TIME,
1718 something is TERRIBLY WRONG."
1719       "There's ANOTHER HIVE somewhere out there.  I HAVEN'T SEEN IT
1720 personally, because I CAN'T MOVE, but we have an AMBASSADOR which forwards
1721 MESSAGES to the OTHER HIVE."))
1722    ;; chute
1723    ('hive-inside:chute
1724     <gameobj> 'hive-inside
1725     #:name "a chute"
1726     #:goes-by '("chute")
1727     #:desc "Messages are being dropped onto the desk via this chute."
1728     #:invisible? #t)
1729    ;; meta-message
1730    ('hive-inside:meta-message
1731     <meta-message> 'hive-inside
1732     #:name "a stray message"
1733     #:goes-by '("meta message" "meta-message" "metamessage" "message" "stray message")
1734     #:desc '((p "Something strange has happened to the fabric and space and time
1735 around this message.  It is floating right above the floor.  It's clearly
1736 rubbage that hadn't been delivered, but for whatever reason it was never
1737 garbage collected, perhaps because it's impossible to do.")
1738              (p "You get the sense that if you tried to read the message
1739 that you would somehow read the message of the message that instructed to
1740 read the message itself, which would be both confusing and intriguing.")))
1741    ;; desk
1742    ('hive-inside:desk
1743     <floor-panel> 'hive-inside
1744     #:name "the Hive Actor's desk"
1745     #:desc "The desk surrounds the Hive Actor on all sides, and honestly, it's a little
1746 bit hard to tell when the desk ends and the Hive Actor begins."
1747     #:invisible? #t
1748     #:goes-by '("Hive Actor's desk" "hive desk" "desk"))))
1749
1750 \f
1751 ;;; Federation Station
1752 (define federation-station
1753   (lol
1754    ('federation-station
1755     <room> #f
1756     #:name "Federation Station"
1757     #:desc
1758     '((p "This room has an unusual structure.  It's almost as if a starscape
1759 covered the walls and ceiling, but upon closer inspection you realize that
1760 these are all brightly glowing nodes with lines drawn between them.  They
1761 seem decentralized, and yet seem to be sharing information as if all one
1762 network.")
1763       ;; @@: Maybe add the cork message board here?
1764       (p "To the west is a door leading back to the underground laboratory."))
1765     #:exits
1766     (list (make <exit>
1767             #:name "west"
1768             #:to 'underground-lab)))
1769    ;; nodes
1770    ;; network
1771    ;; activitypub poster
1772    ;; conspiracy chart
1773    ('federation-station:conspiracy-chart
1774     <readable-desc> 'federation-station
1775     #:name "a conspiracy chart"
1776     #:goes-by '("conspiracy chart" "chart")
1777     #:desc
1778     '((p (i "\"IT'S ALL RELATED!\"") " shouts the over-exuberant conspiracy "
1779          "chart. "
1780          (i "\"ActivityPub?  Federation?  The actor model?  Scheme?  Text adventures? "
1781             "MUDS????  What do these have in common?  Merely... EVERYTHING!\""))
1782       (p "There are circles and lines drawn between all the items in red marker, "
1783          "with scrawled notes annotating the theoretical relationships.  Is the "
1784          "author of this poster mad, or onto something?  Perhaps a bit of both. "
1785          "There's a lot written here, but here are some of the highlights:")
1786       (p
1787        (ul
1788         (li (b "Scheme") " "
1789             (a "http://cs.au.dk/~hosc/local/HOSC-11-4-pp399-404.pdf"
1790                "was originally started ")
1791             " to explore the " (b "actor model")
1792             ". (It became more focused around studying the " (b "lambda calculus")
1793             " very quickly, while also uncovering relationships between the two systems.)")
1794         ;; Subject Predicate Object
1795         (li "The " (a "https://www.w3.org/TR/activitypub/"
1796                       (b "ActivityPub"))
1797             " protocol for " (b "federation")
1798             " uses the " (b "ActivityStreams") " format for serialization.  "
1799             (b "Text adventures") " and " (b "MUDS")
1800             " follow a similar structure to break down the commands of players.")
1801         (li (b "Federation") " and the " (b "actor model") " both are related to "
1802             "highly concurrent systems and both use message passing to communicate "
1803             "between nodes.")
1804         (li "Zork, the first major text adventure, used the " (b "MUDDLE") " "
1805             "language as the basis for the Zork Interactive Language.  MUDDLE "
1806             "is very " (b "Scheme") "-like and in fact was one of Scheme's predecessors. "
1807             "And of course singleplayer text adventures like Zork were the "
1808             "predecessors to MUDs.")
1809         (li "In the 1990s, before the Web became big, " (b "MUDs")
1810             " were an active topic of research, and there was strong interest "
1811             (a "http://www.saraswat.org/desiderata.html"
1812                "in building decentralized MUDs")
1813             " similar to what is being "
1814             "worked on for " (b "federation") ". "
1815             "(See the network spaces desiderata document.)")))))
1816
1817    ;; goblin
1818
1819    ))
1820
1821 \f
1822 ;;; Game
1823 ;;; ----
1824
1825 (define (game-spec)
1826   (append lobby grand-hallway smoking-parlor
1827           playroom break-room computer-room underground-lab
1828           async-museum gift-shop hive-entrance
1829           hive-inside federation-station))
1830
1831 ;; TODO: Provide command line args
1832 (define (run-game . args)
1833   (run-demo (game-spec) 'lobby #:repl-server #t))
1834