Class Kitten has animate ! general if it's been described this turn with parse_name [ w ok n; do { ok = 0; w = NextWord(); if (w == 'kittens' or 'cats') { ok = 1; n++; parser_action=##PluralFound; } if (w == 'kitten' or 'kitty' or 'cat' || w == ((self.&name)-->0)) { ok = 1; n++; } } until (ok == 0); return n; ], state CHAIR_STATE, describe [ i; switch (self.state) { QUEEN_STATE: "^A ", (name) self, " is playing with the red queen."; WOOL_STATE: "^A ", (name) self, " is playing with a ball of worsted."; CHAIR_STATE: if (self has general) rtrue; if ((self.other_kitten).state == 3) { i = self.other_kitten; give i general; "^Two kittens, one white and one black, are playing together by the arm-chair."; } "^A ", (name) self, " is playing by the arm-chair."; default: rtrue; } ], description [; "What a beautiful kitten ", (the) self, " is. Why, it's quite definitely your favourite of the pair, and much prettier than that naughty ", (name) self.other_kitten, "."; ], life [; Ask,Answer,Order: print_ret (The) self, " twitches its whiskers and looks at you with such a clever expression that you are certain it understands every word you are saying."; Kiss: "You give ", (the) self, " a little kiss on its nose, and it looks sweetly and demurely at you."; Attack: "You would never do such a beastly thing to such a defenceless little animal!"; Show: print_ret (The) self, " bats a paw at ", (the) noun, "."; Give,ThrowAt: if (noun ~= red_queen or worsted) { if (action == ##ThrowAt) { move noun to Drawing_Room; print "You toss ", (the) noun, " onto the floor, but ", (the) self; } else print (The) self; " just examines ", (the) noun, " with a quizzical expression."; } print "You toss ", (the) noun, " onto the floor and ", (the) self; if (self in player) print " squirms out of your grasp and"; move noun to Drawing_Room; move self to Drawing_Room; print " scampers after it"; if (noun == worsted) { give worsted general; self.state = WOOL_STATE; print ", quickly turning the neat ball into a tangle"; } else self.state = QUEEN_STATE; "."; ], before [; Take: if (self.other_kitten in player) "You can't hold two kittens at once!"; self.state = HELD_STATE; move self to player; "You pick up ", (the) self, ". What a beautiful creature it is!"; Touch, Rub: print_ret (The) self, " rubs its head against you and purrs softly."; ], after [; Drop: self.state = CHAIR_STATE; move self to Drawing_Room; print_ret (The) self, " squirms out of your arms and scampers away."; Transfer,PutOn,Insert: self.state = CHAIR_STATE; print (The) self, " jumps off ", (the) parent(self); move self to Drawing_Room; ", landing lightly on the floor before scampering away."; ], daemon [ i; give self ~general; self.this_kittens_turn = 1 - self.this_kittens_turn; if (self.this_kittens_turn == false || random(3) == 2) rtrue; new_line; print (The) self; switch (self.state) { HELD_STATE: switch(random(5)) { 1: " mews plaintively."; 2: " purrs quietly to itself."; 3: " purrs contentedly to itself."; 4: " rubs its ears against you."; 5: move self to Drawing_Room; self.state = CHAIR_STATE; " squirms out of your arms and scampers away."; } QUEEN_STATE: switch (random(5)) { 1: " bats at the red queen with its paw."; 2: " stops playing and sits up, pretending to be innocent of any kittenish tendancies."; 3: " knocks the red queen across the floor and chases after it."; 4: " stops to wash itself."; 5: " bites the red queen and shakes it to make sure that it's dead."; } WOOL_STATE: give worsted general; switch (random(5)) { 1: " bats at the ball of worsted with its paw."; 2: " pushes the ball of worsted across the floor and chases after it."; 3: " leaps onto the ball of worsted and grapples bravely with it."; 4: " jumps into the ball of worsted and gets tangled up in a mess of threads."; 5: " stops playing and scratches its ears."; } CHAIR_STATE: if ((self.other_kitten).state == CHAIR_STATE && random(2) == 1) { i = random(5); switch (i) { 1: print " chases after "; 2: print " jumps on top of "; 3: print " washes "; 4: print " scampers around the arm-chair and "; 5: print " bats at "; } print (the) self.other_kitten; switch (i) { 1,3: "."; 2: " and they roll around on the floor."; 4: " chases after it."; 5: " with its paw."; } } switch (random(5)) { 1: " scampers after a speck of dust."; 2: " rolls around on the floor."; 3: " sits up and washes its tail."; 4: " scratches its head on the arm-chair."; 5: " chases its tail."; } } ]; Kitten white_kitten "white kitten" Drawing_Room with name "white", this_kittens_turn false, other_kitten black_kitten; Kitten black_kitten "black kitten" Drawing_Room with name "black", this_kittens_turn true, other_kitten white_kitten;