To play the game, copy and paste the procedures below into Logo. Then use the command HAUNTEDHOUSE to start the game.
TO HAUNTEDHOUSE
LOCAL "KNIFE
LOCAL "ANSWER
MAKE "KNIFE 0
PRINT []
PRINT [Your new kitten has run into an abandoned house.]
PRINT [You can hear it mewing from somewhere inside the]
PRINT [dilapidated structure. You try the door and it]
PRINT [is not locked. Do you:]
PRINT [1. Go inside.]
PRINT [2. Buy a new kitten.]
MAKE "ANSWER READWORD
IFELSE :ANSWER = 1 [
PRINT []
PRINT [The door creaks as you open it, and dust sifts down from]
PRINT [the ceiling onto your head. The house is eerily silent.]
ENTRYWAY
] ~
[LOSTKITTEN]
END
TO LOSTKITTEN
LOCAL "ANSWER
PRINT []
PRINT [You have lost your kitten and you must buy a new one.]
PRINT [Play again?]
PRINT [1. Yes.]
PRINT [2. No.]
MAKE "ANSWER READWORD
IF :ANSWER = 1 [HAUNTEDHOUSE]
END
TO ENTRYWAY
LOCAL "ANSWER
PRINT []
PRINT [You go into the entryway and see three doors in front of you.]
PRINT [Which will you choose?]
PRINT [1. Kitchen.]
PRINT [2. Library.]
PRINT [3. Attic.]
MAKE "ANSWER READWORD
IFELSE (:ANSWER = 1) [KITCHEN] ~
[ IFELSE (:ANSWER = 2) [DININGROOM] ~
[ IFELSE (:ANSWER = 3) [ATTIC] [LOSTKITTEN]]]
END
TO KITCHEN
PRINT []
PRINT [You have found a knife!]
MAKE "KNIFE :KNIFE+1 ; We're using dynamic scope here!
ENTRYWAY
END
TO DININGROOM
PRINT []
PRINT [You are attacked by a rat!]
IFELSE :KNIFE>0 [
PRINT [You kill the rat with the knife, losing the knife!]
MAKE "KNIFE :KNIFE-1 ; We're using dynamic scope here!
ENTRYWAY
] ~
[
PRINT [You flee the house in terror!]
LOSTKITTEN
]
END
TO ATTIC
PRINT []
PRINT [You see your kitten in the talons of a huge owl!]
IFELSE :KNIFE>0 [
PRINT [You stab the owl with your knife and the kitten leaps]
PRINT [free and scampers down the stairs. You run after it.]
PRINT [Once you and the kitten are safe at home, you decide]
PRINT [to write a computer program about your adventure.]
] ~
[
PRINT [As you watch, helpless, the owl flies away with the kitty!]
LOSTKITTEN
]
END