Child's Play

An interactive fiction by Stephen Granade (2007) - the Inform 7 source text

Section 1 - Zoe Kinmundy

Zoe is a playmate in the By the Rocking Chair. Zoe is female. The description is "Grr, Zoe Kinmundy. That little red-haired girl[note red-haired girl] has this [if zoe is wearing the ladybug costume]ladybug costume on, it is supposed to be cute but you are not fooled[otherwise]sundress-like jumper thing, it's not like you know fashion or anything so you're not sure exactly what it is but it leaves her arms and legs bare for speed and evil[end if]. Her red hair is in pigtails, like that will fool anyone into thinking she is nice[if Zoe is carrying something]. She has a death-grip on [a list of things carried by Zoe][end if]." The base act percentage is 20. The act percentage is 20. The act increment is 10. Understand "Kinmundy", "little", "red-haired", "girl", "baby", "pigtail" or "pigtails" as Zoe.

Check smelling Zoe: instead say "You would think she would smell all evil but instead she smells like baby wash."

The fog of grump is scenery in By the Rocking Chair. The description is "Boy, Zoe is grumpy." Instead of doing something other than examining to the fog of grump, say "The fog of grump is more a metaphor than a real thing you can do anything with."

Zoe wears a sundress-like jumper. The description of the sundress-like jumper is "All yellow and it has flowers." Understand "sundress" as the sundress-like jumper.

Rule for pre-writing a paragraph about Zoe when Zoe is carrying your favorite toy: say "Zoe has your toy! ZOE HAS YOUR TOY! [run paragraph on]";

Rule for pre-writing a paragraph about Zoe when Zoe is carrying something (called the item):
    say "Zoe has hold of [a item] [one of]all sadly[or]but she looks like she doesn't like [it-them][or]loosely[purely at random]. [run paragraph on]";

Rule for pre-writing a paragraph about Zoe during Playtime:
    say "Zoe is sitting in a fog of grump on the floor. [run paragraph on]";

Rule for pre-writing a paragraph about Zoe during Snacktime:
    say "Zoe has her eye on you[if 1 out of 8] (not literally)[end if]. [run paragraph on]";

Rule for pre-writing a paragraph about Zoe during Tabletime: rule succeeds.

Rule for pre-writing a paragraph about Zoe when Zoe is wearing the ladybug costume: say "Zoe hunkers in a ladybug costume like a wolf in cute sheep's clothing. [run paragraph on]";

To deal with Zoe and the backpack:
    move the backpack to Parry;
    move your favorite toy to Parry;
    if Parry is present begin;
        say "'Parry, here,' and shoves the backpack at Parry";
        if someone (called the kid) is held by Parry, say ", who says 'Oh!' and puts down [the kid] and takes the backpack";
        otherwise say " who takes it";
        say ". 'Can you get that onesie out of the way?' Parry just nods and digs in the backpack and pulls out your favorite toy and dumps it in his lap! Then he starts tugging the onesie this way and that to free it from the implacable jaws of the backpack zipper. Meanwhile Marion shushes Zoe before sitting back on the loveseat[note parry-opens-backpack].";
    end if;
    if getting points for Parry removing the toy has not occurred, record 5 points for "getting Parry to take the toy out of the backpack";
    if a person (called the kid) is held by Parry, move the kid to the location of the gliding rocking chair, without printing a room description;
    Parry looses the wild onesie in four turns from now.

Instead of taking something held by Zoe during Playtime:
    say "Zoe shrieks at you and yanks back [the noun]. Marion sees that and she reacts in a flash and says ";
    if Marion encloses the backpack, deal with Zoe and the backpack;
    otherwise say "'No, Zoe, no!' and stops doing whatever parent thing she was doing and jumps up and pulls Zoe away from you. 'I'm sorry, Farina,' she tells the mom."

[Like the tearing-yourself-away-from-Cheerios message, I only want the following message to fire once, so I use a global flag for that.]

The Zoe-cant-flee-message-flag is a number that varies.

An every turn rule: change the Zoe-cant-flee-message-flag to 0.

[There is a bug here that I'm not going to bother fixing: this message fires even if you try a command like >DROP TOY when you don't have the toy.]
Before doing something when your favorite toy is held by Zoe and your favorite toy is acted upon (this is the Zoe tries to flee rule):
    if Zoe flees from the player begin;
        say "Zoe sees you coming for the toy! She will not let you have it!";
        have Zoe flee from the player;
        stop the action;
    otherwise if the Zoe-cant-flee-message-flag is 0;
        change the Zoe-cant-flee-message-flag to 1;
        say "Zoe tries to crawl away, but there are babies and Cheerios and it is a big train-wreck and she cannot get away!";
    end if.

The Zoe tries to flee rule is listed after the Cheerios message rule in the Before rules.

Instead of taking your favorite toy when your favorite toy is held by Zoe (this is the snatch the toy from Zoe rule):
    [Run through some of the check taking rules. We can't use the entire rulebook, since the can't take people's possessions rule would kick in, and besides, we only care about the size rules]
    abide by the can't take small things when burdened rule;
    say "You lunge forward and yank on the toy and Zoe is all distracted by Cheerios and the toy pops out of her evil sweaty grasp! You have your toy!";
    record 10 points for "getting your favorite toy for the last time";
    [Normally I would move the toy to the player and trigger the scene end on that, but then you can do like Admiral Jota did and do things like GIVE TOY TO CASSIE that trigger an implicit TAKE. By removing the toy from play, the implicit take stops short.]
    remove your favorite toy from play.

[Get rid of the (first taking your toy) bit from an implicit take of your favorite toy.]
Rule for implicitly taking your favorite toy when your favorite toy is held by Zoe:
    instead try silently taking the noun.

Instead of attacking or pushing or pulling or chewing Zoe, say "There is no way the parents will believe you had nothing to do with hurting her, you'd better leave her alone for now."

Instead of attacking or pushing or pulling or chewing Zoe when your favorite toy is held by Zoe:
    if the pile of Cheerios is present, instead say "Then she would cry and the parents would see you and you would look like the bad baby, you should just grab the toy instead.";
    say "Zoe sees you coming and she runs like the toyful coward she is!";
    have Zoe flee from the player;

Instead of attacking or chewing Zoe when Marion encloses the backpack:
    say "You wait until no one is looking and then attack Zoe, it is a little hand-to-hand attack that even a level 1 wizard could do better. Zoe shrieks and hits back and of course Marion sees that and she reacts in a flash and says ";
    deal with Zoe and the backpack.

Instead of pushing or pulling Zoe when Marion encloses the backpack:
    say "You give Zoe this hard shove when no one is looking and Zoe shrieks and hits back. Marion sees that and she reacts in a flash and says ";
    deal with Zoe and the backpack.

Instead of showing or giving something to a playmate (called p) when the player is held by Parry during Playtime (this is the player is too high to show things to people rule):
    say "Parry has you so high that [p] can't see [the noun]."

Instead of showing or giving something to Zoe during Playtime:
    move the noun to the location;
    if the player is gnawing the noun, now the noun is not gnawed by anything;
    say "Zoe shrieks at you and shoves [the noun] out of your hands and hits at you. Marion sees that and she reacts in a flash and says ";
    if Marion encloses the backpack, deal with Zoe and the backpack;
    otherwise say "'No, Zoe, no!' and stops doing whatever parent thing she was doing and jumps up and pulls Zoe away from you. 'I'm sorry, Farina,' she tells the mom."

Instead of someone showing or giving something to Zoe during Playtime:
    if Zoe is present, say "[The person asked] offers [the noun] to Zoe and Zoe shrieks and shoves and kicks at [the noun] and at [the person asked][note baby-state-machines]. Marion sees that and she reacts in a flash and says, ";
    if Marion encloses the backpack begin;
        deal with Zoe and the backpack;
    otherwise if Zoe is present;
        say "'No, Zoe, no!' and stops doing whatever parent thing she was doing and jumps up and pulls Zoe away from [the person asked]. 'Sorry about Zoe's behavior,' she says all apologetically.";
    end if.

Instead of showing or giving the poosh stick to Zoe during Cooperationtime, say "Zoe sniffs, it is clear she has no interest in doing any pooshing with the stick."

Instead of showing or giving something to Zoe, say "Zoe eyes you coldly, no way she is taking anything from you[if Dejectiontime is happening] even if she is all dejected[end if]."

Instead of someone showing or giving something to Zoe:
    if Zoe is present, say "[The person asked] tries to give [the noun] to Zoe but she will have none of it[if 1 out of 6], she is so unfriendly[end if]."

This is the ZK taking report rule:
    say "Zoe [one of]snatches[or]grabs[or]totally takes[purely at random] [the noun]. [run paragraph on]";

This is the ZK playtime dropping report rule:
    let switch-value be a random number from 1 to 3;
    if switch-value is 1, say "Zoe drops [the noun] and [one of]shoves[or]pushes[purely at random] [it-them] away from her";
    if switch-value is 2, say "Zoe tosses [the noun] aside";
    if switch-value is 3, say "Zoe takes [the noun] and [one of]tosses [it-them] aside[or]shoves [it-them] away[or]drops [it-them][purely at random]";
    say ". [run paragraph on]".

This is the ZK dropping report rule:
    let switch-value be a random number from 1 to 3;
    if switch-value is 1, say "Zoe drops [the noun] like it is on fire";
    if switch-value is 2, say "Zoe lets [the noun] fall from her hands";
    if switch-value is 3, say "Zoe tosses [the noun] aside";
    say ". [run paragraph on]".

This is the ZK going report rule:
    if Zoe is present, say "[Zoe possibly making noise when moving]Zoe stalks in from [the opposite of the direction tried of Zoe] and settles near you. [run paragraph on]";
    if Zoe was recently present, say "[Zoe possibly making noise when moving]Zoe [if the just-released item is not nothing]lets go of [the just-released item] and [end if]stalks off to [the direction tried of Zoe]. [run paragraph on]".

This is the ZK fleeing report rule:
    if Zoe is present, say "Zoe comes in from [the opposite of the direction tried of Zoe][if Zoe carries your favorite toy] with your toy[end if]! [run paragraph on]";
    if Zoe was recently present, say "Zoe [if the last location of Zoe is the location of the pile of Cheerios]somehow ignores the Cheerios and [end if][if a not-Zoe-baby playmate is in the last location of Zoe]pushes her way past babies [end if][if the last location of Zoe is the location of the pile of Cheerios and a not-Zoe-baby playmate is in the last location of Zoe]who don't move very fast because of the Cheerios [end if][if a not-Zoe-baby playmate is in the last location of Zoe]and [end if]runs off to [the direction tried of Zoe][if Zoe carries your favorite toy] with your toy[end if]! [if 1 out of 4]SHE HAS YOUR TOY! [end if][run paragraph on]".

[There is this subtil bug in I7 where, if you push one of the blocks around and Zoe stalks after you, the following rule gets triggered. So I hack around the report by not having it fire during Snacktime.]
After Zoe going a direction (called way-pooshed) with something (called the pooshed-thing) when Snacktime is not happening (this is the Zoe pushing things to a new room rule):
    if Zoe is present, say "You see [the pooshed-thing] coming towards you from [the opposite of way-pooshed], it is alive! But no, it is just Zoe pushing it around.";
    if Zoe was recently present, say "Zoe pushes and pushes at [the pooshed-thing] until it and she goes off to [the way-pooshed]."

[Have Zoe stalk the player during Snacktime]
After going a direction during Snacktime (this is the Zoe stalks the player rule):
    consider the report going rules;
    consider the stalking Zoe rule;

After going a direction with something during Snacktime (this is the second Zoe stalks the player rule):
    consider the stalking Zoe rule;
    continue the action.

The second Zoe stalks the player rule is listed after the pushing things to a new room rule in the after rulebook.

[This next rule in part duplicates the actions of the cruise the player rule. Keep them synchronized.]
Instead of going a direction (called goal) when the player is pulled up on something (called support) during Snacktime (this is the third Zoe stalks the player rule):
    if going goal while holding onto support involves cruising begin;
        let furnishing be the other end of support to the goal;
        cruise the player to the goal and hold the furnishing;
        consider the stalking Zoe rule;
    otherwise;
        continue the action;
    end if.

This is the stalking Zoe rule:
    let flag be 0;
    if the location is in the Middle Ring and the location of Zoe is in the Outer Ring, change flag to 1;
    if the location is the North End of Loveseat begin;
        if the location of Zoe is in the Outer Ring or the location of Zoe is in the Middle Ring, change flag to 1;
    end if;
    if the location is in the Hidden Area and the location of Zoe is not in the Hidden Area, change flag to 1;
    if the location is By the Cabinet and the location of Zoe is not By the Cabinet, change flag to 1;
    if flag is 1 begin;
        if Zoe clears all inventory begin;
            if Zoe is present and some thing is marked for special listing, say "Zoe tosses [a list of things that are marked for special listing] aside.";
            let way be the best route from the location of Zoe to the location;
            if way is a direction, try Zoe going way;
        end if;
        now every thing is unmarked for special listing;
    end if.

ZK Fussing Rules is a rulebook.

A ZK fussing rule when Zoe is carrying anything (this is the Zoe fusses with inventory rule):
    if 3 out of 4 begin;
        if Zoe is not present, rule succeeds;
        let target be a random thing carried by Zoe;
        let switch-value be a random number from 1 to 10;
        if target is chewable and switch-value is less than 4, say "Zoe [one of]gives [the target] a brief chew[if 1 out of 3] or two[end if][if 2 out of 7] before spitting it out with a 'buh' noise[end if][or]puts [the target] in her mouth and gnaws [it-them] some but then she lets [it-them] fall out of her mouth[purely at random].";
        otherwise if switch-value is less than 6, say "Zoe [one of]looks[or]stares[purely at random] at [the target] and she sighs.";
        if switch-value is greater than 5 begin;
            if 1 out of 2, say "Zoe pulls at [the target] but then she stops[if 1 out of 4], she is so bored with [it-them][end if].";
            otherwise say "Zoe [one of]shakes [the target][or]takes [the target] and shakes [it-them][purely at random] half-heartedly[if 1 out of 4], she is so bored with [it-them][end if].";
        end if;
        rule succeeds;
    end if.

A ZK fussing rule when Zoe is carrying anything (this is the Zoe disgustedly drops inventory rule):
    try Zoe dropping a random thing carried by Zoe;
    rule succeeds.

Fuss count is a number that varies. Fuss count is 0.

To say Marion asking Parry to stop rocking:
        let switch-value be a random number from 1 to 3;
        if switch-value is 1, say ". That makes Marion [one of]sigh[or]laugh[or]smile[purely at random] and she says, 'Parry, if you don't mind?' So";
        if switch-value is 2, say ". Marion says 'Okay, Zoe, okay' and laughs and says 'Excuse me, Parry, I need to get a toy from Zoe's backpack. Again.' So";
        if switch-value is 3, say ". 'I know, Zoe,' Marion says[if 1 out of 5], she is laughing as she says it[end if]. So";
        say " [if Parry is rocking]Parry stops rocking long enough for Marion to reach[otherwise]Marion reaches[end if] the backpack under the rocking chair ".

Getting points for Parry removing the toy is a one-time deal.

Mentioning not-fave-toyness is a one-time deal.

A ZK fussing rule (this is the Zoe grumbling rule):
    if Zoe is present begin;
        if the backpack is open and the backpack is in By the Rocking Chair and Parry does not enclose the backpack begin;
            say "Zoe shrieks angrily and bounces up and down and flails her arms in the general direction of the backpack that you opened";
            increase fuss count by 4;
        otherwise;
            let switch-value be a random number from 1 to 3;
            if switch-value is 1, say "Zoe makes this sort of [one of]coughing[or]grumping[purely at random] [one of]hiccuping[or]grunting[purely at random] half-[one of]sob[or]cry[purely at random][if 1 out of 5], it is so annoying[end if]";
            if switch-value is 2, say "Zoe clenches her tiny fists and [one of]waves them while complaining[or]complains loudly[purely at random] about life";
            if switch-value is 3, say "Zoe [one of]scrunches[or]screws[purely at random] up her face and bursts into wails[if 1 out of 8], those are so baby crocodile tears[end if]";
        end if;
    end if;
    increment fuss count by 1;
    if fuss count is greater than 2 plus a random number from 1 to 2 begin;
        now fuss count is 0;
        remove the plain white onesie from play; [so Marion can't grab it]
        let item be a random thing in the backpack;
        let item-in-backpack-flag be 1;
        [If the backpack is empty for some reason, have Marion grab something else instead. This shouldn't happen, but apparently some times it does.]
        if item is nothing begin;
            repeat through the Table of Stuff Originally In the Backpack begin;
                if the stuff entry is not carried begin;
                    change item to the stuff entry;
                    change item-in-backpack-flag to 0;
                    stop repeating;
                end if;
            end repeat;
        end if;
        move the item to Zoe;
        if the item is not carried by Zoe begin;
            change hacky global item to the item;
            report bug "Tried to move [the hacky global item] to Zoe but failed for some reason.";
        end if;
        if the backpack is open and the plain white onesie is stuck begin;
            [Put the white onesie back]
            move the plain white onesie to the backpack;
            move the backpack to Marion;
            now the backpack is handled;
            if Zoe is present begin;
                say Marion asking Parry to stop rocking;
                say "and she sees the white onesie stuck in the backpack. 'Geez,' she says and [if item-in-backpack-flag is 0]grabs [a item] from the floor[otherwise]pulls out [a item][end if] and dumps it in Zoe's lap. Zoe gets all upset but Marion says, 'Shh, Zoe, be calm, I can't fix the backpack if you're fussing.' Parry says, 'Here, I'll empty out the backpack and fix that for you' but Marion says 'No, thanks,' and she sits down and starts trying to get the onesie out of the backpack";
            otherwise;
                say "You can hear Zoe squalling all loudly by the gliding rocking chair";
                if Marion is present, say " and Marion stands up and in a moment comes back with the backpack";
            end if;
            Marion almost removes the toy in one turn from now;
        otherwise;
            if Zoe is present begin;
                say Marion asking Parry to stop rocking;
                say "and then she digs around and [if item-in-backpack-flag is 0]there's nothing in there so she grabs [a item] from the floor[otherwise]pulls out [a item][end if] and closes the backpack and she gives [the item] to Zoe[if 1 out of 4] and says 'Here you go!' [otherwise]. [end if]Then Zoe [if mentioning not-fave-toyness has not occurred]sees that it's not your favorite toy, ha ha to her, and she [end if][one of]squalls[or]shrieks[or]fusses[purely at random] and tries to shove [the item] away but Marion says, 'Shh, Zoe, be calm,' and makes Zoe take [it-them of the item]";
            otherwise;
                say "You can hear Zoe squalling all loudly by the gliding rocking chair";
                if Marion is present, say " and Marion stands up and goes to quiet her and then comes back in a second";
                say ".";
            end if;
        end if;
        if no thing is in the backpack begin;
            if Zoe is present, say ".[paragraph break]Marion also spends some time grabbing a bunch of discarded toys and throwing them back in the backpack[run paragraph on]";
            repeat through the Table of Stuff Originally In the Backpack begin;
                if the stuff entry is not carried, move the stuff entry to the backpack;
            end repeat;
        end if;
        if the backpack is open and the backpack is not held by Marion, now the backpack is closed;
    end if;
    if Zoe is present, say ".";
    rule succeeds.

ZK Stalking Rules is a rulebook.

A ZK stalking rule when Zoe is carrying some thing (this is the Zoe dumping inventory rule):
    try Zoe dropping a random thing carried by Zoe;
    rule succeeds.

A ZK stalking rule (this is the Zoe picking up stuff rule):
    if 3 out of 5 begin;
        let position be the location of Zoe;
        if a pickupable thing is in position begin;
            let target be a random pickupable thing in position;
            try Zoe taking target;
            rule succeeds;
        end if;
    end if.

A ZK stalking rule (this is the Zoe wanders rule):
    if Zoe is ready to leave begin;
        let position be the location of Zoe;
        if the location is By the Cabinet, rule fails;
        if the location is in the Hidden Area, rule fails;
        if the location is the North End of Loveseat begin;
            if position is By the Cabinet begin;
                try zoe going north;
            otherwise;
                let way be the best route from position to By the Cabinet;
                if way is a direction, try zoe going way;
            end if;
            rule succeeds;
        end if;
        if the location is in the Middle Ring begin;
            [This is a compromise solution that I'm not really happy with]
            let goal be a random room which is adjacent to position;
            while goal is in the Outer Ring begin;
                now goal is a random room which is adjacent to position;
            end while;
            if goal is not position begin;
                let aim be the best route from the location of Zoe to goal;
                if aim is a direction, try zoe going aim;
            end if;
            rule succeeds;
        end if;
        have Zoe wander;
        rule succeeds;
    end if.

[A rulebook to get Zoe to push the blocks into the TKBUG Open Area, and rules to keep the player from messing with blocks when Zoe's around]

Instead of going a direction with a pushable between rooms enterable supporter (called the platform) when Zoe is present and (your favorite toy is in the bookcase or Cooperationtime is happening):
    if Zoe is zeroth-height begin;
        say "You start pushing on [the platform] but then Zoe slithers to the other side and keeps you from moving it.";
    otherwise if Zoe is on the platform;
        say "Zoe just looks at you with this satisfied smile since you cannot push [the platform] while she is on it.";
    otherwise;
        if the platform is the short plastic block and Zoe is on the tall plastic block begin;
            say "Zoe takes this crazy leap from the tall block onto the short one and sticks the landing! That is all impressive even though it keeps you from pushing the short block around.";
        otherwise if the platform is the tall plastic block and Zoe is on the short plastic block;
            say "When you start pushing on [the platform] Zoe slides off of the short block and moves to the other side of [the platform] so you can't make it go anywhere.";
            instead move Zoe to the location of the platform;
        otherwise;
            say "You start pushing on [the platform] but Zoe moves onto it so you can't move it, grr.";
        end if;
        move Zoe to the platform;
    end if.

Zoe can be up-climbing or down-climbing. Zoe is up-climbing.

[TK BUG: I'd like to use a rulebook variable here, but it looks like I can't then refer to that rulebook variable in the when/while clauses of the rulebook's rules' premises themselves.]
ZK Climbing Rules is a rulebook. [TK NO GOOD The ZK climbing rules rulebook has an object called the push-block.] The push-block is an object that varies.

The first ZK climbing rule (this is the determine Zoe's block of choice rule):
    [During block pushing and climbing, Zoe moves fast]
    change the base act percentage of Zoe to 100;
    change the act percentage of Zoe to 100;
    if the short plastic block is not in the TKBUG Open Area begin;
        change the push-block to the short plastic block;
    otherwise if the bugish plastic block is not in the TKBUG Open Area;
        change the push-block to the bugish plastic block;
    otherwise if the tall plastic block is not in the TKBUG Open Area;
        change the push-block to the tall plastic block;
    otherwise;
        [In case Zoe goes wandering away from the blocks for whatever reason, use the Zoe heads for the push-block rule to bring her back]
        change the push-block to the tall plastic block;
        ignore the Zoe pushes the push-block rule;
        [If the player is in the baby swing, make Zoe head up]
        if the player is in the baby-swing, now Zoe is up-climbing;
    end if.

A ZK climbing rule when Zoe and the push-block are not co-located (this is the Zoe heads for the push-block rule):
    let way be the best route from the location of Zoe to the location of the push-block;
    if way is a direction, try Zoe going way;
    rule succeeds.

A ZK climbing rule when Zoe and the push-block are co-located (this is the Zoe pushes the push-block rule):
    let way be the best route from the location of Zoe to the TKBUG Open Area;
    if way is a direction, try Zoe pushing the push-block to the way;
    rule succeeds.

Mentioning suck-it-ness is a one-time deal.

To say Zoe's annoyance at player thwarting her climb (d - a direction) onto (b - a thing):
    say "Zoe starts to climb [d] onto [the b] but then since you are on the [if d is up]higher[otherwise]lower[end if] blocks she looks [d] at you and makes this annoyed face[if mentioning suck-it-ness has not occurred], ha ha, she can suck it[end if][if the player is on the bugish plastic block]. Clearly she is waiting for you to go down directly from the medium block[end if].".

A ZK climbing rule when Zoe is zeroth-height and Zoe is up-climbing (this is the Zoe starts climbing blocks rule):
    if the player is on the short plastic block, say Zoe's annoyance at player thwarting her climb up onto the short plastic block;
    otherwise try Zoe entering the short plastic block;
    rule succeeds.

A ZK climbing rule when Zoe is on the short plastic block and Zoe is up-climbing (this is the Zoe climbs up from the short block rule):
    if the player is on the bugish plastic block or the player is on the tall plastic block, say Zoe's annoyance at player thwarting her climb up onto the bugish plastic block;
    otherwise try Zoe entering the bugish plastic block;
    rule succeeds.

A ZK climbing rule when Zoe is on the bugish plastic block and Zoe is up-climbing (this is the Zoe climbs up from the bugish plastic block rule):
    if the player is on the tall plastic block begin;
        say Zoe's annoyance at player thwarting her climb up onto the tall plastic block;
    otherwise;
        try Zoe entering the tall plastic block;
        if Cooperationtime is happening and Zoe is on the tall plastic block and Zoe and the player are not co-located, say "You hear this cough from Zoe[note stranding-zoe].";
    end if;
    rule succeeds.

Making a use-everything-in-the-inventory joke is a one-time deal.

A ZK climbing rule when Zoe is on the tall plastic block and Zoe is up-climbing (this is the Zoe can't reach the toy on the bookcase rule):
    if the player is in the baby-swing begin;
        say "Zoe watches you swing back and forth, back and forth.";
    otherwise if 1 out of 2;
        if the player and Zoe are co-located begin;
            if Zoe is carrying something (called the carried item), say "Zoe [one of]waves [the carried item] at your favorite toy[or]pokes [the carried item] towards your favorite toy[or]looks like she wants to throw [the carried item] at your favorite toy but can't[or]lifts [the carried item] into the air as if it will magically get her your favorite toy[purely at random][if 1 out of 2 and making a use-everything-in-the-inventory joke has not occurred], she is doing the baby equivalent of randomly using everything in your inventory on an object[note meta-joke][end if].";
            otherwise say "Zoe [one of]reaches for the toy in the bookcase but can't reach it[or]makes sad moon-eyes at your favorite toy[or]is all sad that she can't reach the toy[purely at random].";
        end if;
        now Zoe is down-climbing;
    end if;
    rule succeeds.

A ZK climbing rule when Zoe is on the tall plastic block and Zoe is down-climbing (this is the Zoe climbs down from the tall plastic block rule):
    if the player is on the bugish plastic block, say Zoe's annoyance at player thwarting her climb down onto the bugish plastic block;
    otherwise try Zoe entering the bugish plastic block;
    rule succeeds.

A ZK climbing rule when Zoe is on the bugish plastic block and Zoe is down-climbing (this is the Zoe climbs down from the bugish plastic block rule):
    if the player is on the short plastic block, try Zoe going down;
    otherwise try Zoe entering the short plastic block;
    rule succeeds.

A ZK climbing rule when Zoe is on the short plastic block and Zoe is down-climbing (this is the Zoe climbs down from the short plastic block rule):
    try Zoe going down;
    rule succeeds.

A ZK climbing rule when Zoe is zeroth-height and Zoe is down-climbing (this is the Zoe contemplates her options rule):
    if the player and Zoe are co-located, say "Zoe [run paragraph on]";
    let target be a random small carryable thing in the location of Zoe;
    if Zoe is carrying something (called the carried item) begin;
        silently try Zoe dropping the carried item;
        if the carried item is not carried by Zoe and (the player and Zoe are co-located), say "[one of]drops[or]tosses aside[or]discards[purely at random] [the carried item] and she [run paragraph on]";
    end if;
    if target is not nothing begin;
        silently try Zoe taking the target;
        if the target is carried by Zoe and (the player and Zoe are co-located), say "[one of]grabs[or]picks up[purely at random] [a target].";
    otherwise;
        if the player and Zoe are co-located, say "[one of]contemplates the toy[or]is clearly thinking about how to get that toy[or]nudges one of the blocks thoughtfully[purely at random].";
    end if;
    now Zoe is up-climbing;
    rule succeeds.

ZK Moping Rules is a rulebook.

[Borrow the rules for Zoe climbing down from the blocks.]
The Zoe climbs down from the tall plastic block rule is listed in the ZK Moping Rules.
The Zoe climbs down from the bugish plastic block rule is listed in the ZK Moping Rules.
The Zoe climbs down from the short plastic block rule is listed in the ZK Moping Rules.

A ZK moping rule when Zoe is carrying something (called the carried item) (this is the Zoe discards whatever she was fiddling with rule):
    try Zoe dropping the carried item.

The Zoe discards whatever she was fiddling with rule is listed after the Zoe climbs down from the short plastic block rule in the ZK Moping Rules.

[If Zoe's not next to the player and the player's in a room w/a playpen, move Zoe.]
A ZK moping rule when Zoe and the player are not co-located (this is the Zoe mopes around the player rule):
    if the location is the Middle of the Living Room or the location is the TKBUG Open Area begin;
        move Zoe to the location;
        say "Zoe comes in [one of]all sadly[or]slowly[or]dejectedly[or]and sighs heavily[or]and looks sadly at the playpen[purely at random].";
        rule succeeds;
    end if.

The Zoe mopes around the player rule is listed after the Zoe discards whatever she was fiddling with rule in the ZK Moping Rules.

A ZK moping rule:
    if 1 out of 6 begin;
        if Zoe is present, say "Zoe [one of]pokes dejectedly at the playpen[or]looks at the playpen[or]looks at you and does this sad little shrug[or]hunches her shoulders sadly[or]sighs[or]frowns[or]looks around listlessly[purely at random].";
        rule succeeds;
    end if.

ZK Cooperating Rules is a rulebook.

The determine Zoe's block of choice rule is listed first in the ZK Cooperating Rules.
The Zoe heads for the push-block rule is listed in the ZK Cooperating Rules.
The Zoe pushes the push-block rule is listed in the ZK Cooperating Rules.
The Zoe starts climbing blocks rule is listed in the ZK Cooperating Rules.
The Zoe climbs up from the short block rule is listed in the ZK Cooperating Rules.
The Zoe climbs up from the bugish plastic block rule is listed in the ZK Cooperating Rules.

A ZK cooperating rule when Zoe is on the tall plastic block:
    if 1 out of 4 begin;
        if Zoe is present, say "Zoe looks at you and coughs pointedly.";
        otherwise say "You hear this cough, it is Zoe trying to get your attention.";
        rule succeeds;
    end if.

ZK Toy-Grabbing Rules is a rulebook.

A ZK toy-grabbing rule when Zoe is on the tall plastic block (this is the Zoe scampers down from the tall block rule):
    try Zoe entering the bugish plastic block;
    rule succeeds.

A ZK toy-grabbing rule when Zoe is on the bugish plastic block (this is the Zoe scampers down from the bugish plastic block rule):
    try Zoe going down;
    rule succeeds.

[This next rule shouldn't be needed, but just in case...]
A ZK toy-grabbing rule when Zoe is not carrying your favorite toy and Zoe and your favorite toy are not co-located (this is the Zoe goes towards the toy rule):
    let way be the best route from the location of Zoe to the location of your favorite toy;
    if way is a direction, try Zoe going way;
    rule succeeds.

A ZK toy-grabbing rule when Zoe is not carrying your favorite toy (this is the Zoe ganks the toy rule):
    try Zoe taking your favorite toy;
    rule succeeds.

[I'll borrow Fuss Count, a global variable that Zoe uses when she fusses in the first major scene, to let Zoe flee only after one turn.]

A ZK toy-grabbing rule when Zoe is present (this is the Zoe flees from you with the toy rule):
    if fuss count is 1 begin;
        have Zoe flee from the player;
        rule succeeds;
    otherwise;
        increment fuss count by 1;
    end if.

A ZK toy-grabbing rule when Zoe is not present (this is the Zoe plays with your toy rule):
    if 1 out of 5, say "You hear this rattle jingle, it is Zoe playing with your toy!";
    rule succeeds.

[Another hack to let me pick a non-Zoe playmate.]
Definition: a person is not-Zoe-baby:
    if it is the player, decide yes;
    if it is a playmate and it is not Zoe, decide yes;
    decide no.

[There are two routines here. The first defines whether or not Zoe will flee successfully (which she will do as long as she's not in the room with the pile of Cheerios and with some playmate who's not her). The second forces Zoe to flee.]
To decide if Zoe flees from the player:
    if Zoe and the pile of Cheerios are co-located begin;
        if a not-Zoe-baby playmate is in the location of Zoe, decide no;
    end if;
    decide yes.

To have Zoe flee from the player:
    let destination be a random room which is adjacent to the location of Zoe;
    [Make Zoe head for the pile of Cheerios if they're around]
    if the pile of Cheerios is in play and the pile of Cheerios and Zoe are not co-located, change destination to the location of the pile of Cheerios;
    let way be the best route from the location of Zoe to the destination;
    if way is a direction, try Zoe going way;
    now fuss count is 0.

The source code to Child's Play is licensed under a Creative Commons NonCommercial Sampling Plus 1.0 License.