Action Queuing

version 3 by Jesse McGrew

  • Home page
  • Beginning
  • Previous



  • Example: *** Moving In - Actors move various items between rooms.

        "Moving In"

        Include Action Queuing by Jesse McGrew and Case Management by Emily Short.

        Moving Furniture is a scene. Moving Furniture begins when play begins.

        Living Room is a room. "Hauling furniture is such a pain. Good thing you [if Moving Furniture is happening]don't[otherwise]didn't[end if] have to do it yourself![line break]Your bedroom is to the east, your kitchen is west, and the street is outside to the north."

        Street is north of Living Room. "The front door of your new house is to the south." Outside of the living room is the street. Bedroom is east of Living Room. "Your living room is to the west." Kitchen is west of Living Room. "Your living room is to the east."
        
        The counter is a supporter in the kitchen, fixed in place.

        The house is a region. The bedroom, the living room, and the kitchen are in the house.

    The movers will bring in a bunch of items from their truck.

        A vehicle called the moving truck is in the street. In the truck are a kitchen table, a TV stand, a television, a couch, a bed frame, a mattress, a bookcase, a night stand, a microwave oven, a toaster, a refrigerator, a box of spices, a box of silverware, a box of sheets, and a box of books. The night stand, the TV stand, the kitchen table, and the bed frame are portable supporters.

        Instead of opening something, say "You can work on that later." Instead of taking something, say "If you felt like carrying anything today, you wouldn't have hired the movers!"

        The bill is a thing. The description of the bill is "$500. Ouch!"

        When play begins: set up the big items queue; set up the small items queue.

    Bruno will move the large items.

        Bruno is a transparent person in the street.

        To set up the big items queue:
            have Bruno move the refrigerator to the kitchen;
            have Bruno move the kitchen table to the kitchen;
            have Bruno move the television onto the TV stand in the living room;
            have Bruno move the mattress onto the bed frame in the bedroom;
            have Bruno move the bookcase to the bedroom;
            have Bruno move the box of books to the bedroom.

    Chuck will move the small items. He can move two at once.

        Chuck is a transparent person in the street.

        To set up the small items queue:
            have Chuck move the spices and the silverware onto the kitchen table in the kitchen;
            have Chuck move the TV stand to the living room;
            have Chuck move the toaster and the microwave onto the counter in the kitchen;
            have Chuck move the night stand and the sheets to the bedroom;
            have Chuck move the bed frame to the bedroom.

    Now we'll need some phrases to queue a group of actions for moving:

        To have (actor - person) move (x - thing) to (destination - room):
            queue actor trying taking x;
            let L be the location of the actor;
            plan a route for actor from L to destination;
            queue actor trying dropping x;
            plan a route for actor from destination to the street.
        
        To have (actor - person) move (x - thing) and (y - thing) to (destination - room):
            queue actor trying taking x;
            queue actor trying taking y;
            let L be the location of the actor;
            plan a route for actor from L to destination;
            queue actor trying dropping x;
            queue actor trying dropping y;
            plan a route for actor from destination to the street.

        To have (actor - person) move (x - thing) onto (base - supporter) in (destination - room):
            queue actor trying taking x;
            let L be the location of the actor;
            plan a route for actor from L to destination;
            queue actor trying waiting for the base;
            queue actor trying putting x on the base;
            plan a route for actor from destination to the street.

        To have (actor - person) move (x - thing) and (y - thing) onto (base - supporter) in (destination - room):
            queue actor trying taking x;
            queue actor trying taking y;
            let L be the location of the actor;
            plan a route for actor from L to destination;
            queue actor trying waiting for the base;
            queue actor trying putting x on the base;
            queue actor trying putting y on the base;
            plan a route for actor from destination to the street.

        To plan a route for (actor - person) from (loc - room) to (destination - room):
            while loc is not the destination
            begin;
                let way be the best route from loc to destination;
                queue actor trying going the way;
                let loc be the room the way from loc;
            end while.

    We'll need a "waiting for" action when one mover is waiting for the other to bring a supporter. We can requeue the action immediately to keep him waiting until it arrives.

        Coworking relates one person to another (called the coworker). The verb to be employed with implies the coworking relation. Bruno is employed with Chuck.

        A thing can be delayed. A thing is usually not delayed.

        Waiting for is an action applying to one visible thing.

        Carry out someone trying waiting for something:
            if the noun is in the location of the person asked, perform the next queued action for the person asked instead;
            if the noun is not delayed and the player can see the person asked
            begin;
                say "[The person asked] looks around and says, 'Why's [the coworker of the person asked] taking so long with that [noun]?'";
                now the noun is delayed;
            end if;
            if the noun is not delayed and the person asked is in a room adjacent to the location
            begin;
                let X be the location of the person asked;
                say "You hear [the person asked] mumbling about [the coworker of the person asked] in the [X in lower case].";
                now the noun is delayed;
            end if;
            queue the person asked trying waiting for the noun immediately.

        Definition: a person is other if it is not the player.

        Instead of examining an other person (called mover):
            if the mover is carrying something, say "[The mover] is carrying [a list of things carried by the mover][if the mover is waiting for a supporter], looking frustrated as he waits for [the coworker of the mover] to bring [the particular supporter].";
            otherwise say "[The mover] is [if no actions are queued for the mover]standing here lazily.[otherwise]busy."
            
        To decide whether (mover - person) is waiting for a supporter:
            repeat with x running through supporters
            begin;
                change the particular supporter to x;
                if waiting for x is queued next for the mover, decide yes;
            end repeat;
            decide no.

        The particular supporter is a supporter which varies.

        A person can be yappy or quiet. A person is usually quiet.

        Every turn:
            repeat with mover running through other people
            begin;
                let griping be 0;
                let orker be the coworker of the mover;
                if orker is in the location of the mover and the mover is waiting for a supporter and the particular supporter is not in the location of the mover
                begin;
                    if the mover is not yappy and the player can see the mover
                    begin;
                        if the orker is carrying the particular supporter, say "[The mover] says, 'Gee thanks, [orker]. It's about time you brought that [particular supporter]!'";
                        otherwise say "[The mover] says, 'C'mon, [orker], what are you doing[if the orker is carrying something] with that [random thing carried by the orker][end if]? Bring in [the particular supporter]!'";
                        now the mover is yappy;
                    end if;
                    if the mover is not yappy and the mover is in a room adjacent to the location
                    begin;
                        let X be the location of the mover;
                        say "You hear [the mover] yelling at [the orker] in the [X in lower case].";
                        now the mover is yappy;
                    end if;
                    let griping be 1;
                end if;
                if griping is 0, now the mover is quiet;
            end repeat.

    We'll run the queued actions every turn.

        First every turn rule: perform the next queued action for every person.

    The game ends once everything is moved and the player reads the bill.

        Moving Furniture ends when no actions are queued for Bruno and no actions are queued for Chuck.

        When Moving Furniture ends:
            if the player can see Chuck, say "Chuck hands you the bill.";
            otherwise say "Chuck steps [if the player is in the street]out of your house[otherwise]in[end if] and hands you the bill.";
            move Chuck to the location;
            now the player carries the bill.

        After examining the bill: end the game saying "You have moved in".

        Test me with "w/z/z/z/z/x chuck/z/z/z/z/z/z/e/z/z/z/z/z/z/z/z/e/w/z/z/z/z/z/z/e/z/z/z/z/z/z/z/z/z/w/n/z/z/z/s/z/z/z/z/e/w/z/read bill".