Patrollers

version 12 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: ** January Sales - A short example to show patrollers moving on different turns.
        "January Sales" by Michael Callaghan
        Include Patrollers by Michael Callaghan.
        Sale Hall is a room. "The season's bargains are piled high. Even at 20p, it is unlikely that 2007 diaries will sell well but for those prepared to rummage there are bargains to be found.[if we have not opened the glass doors] Through the glass doors you can see the crowds of people are waiting outside Tramlaw for the start of the January sales."
        The Entrance is a room.
        Amy is a patroller in the Entrance. Amy is targeted. The destination of Amy is Cubicle One. The Turn Frequency of Amy is 1.
        Beth is a patroller in the Entrance. Beth is targeted. The destination of Beth is Cubicle Two. The Turn Frequency of Beth is 2.
        Charlie is a patroller in the Entrance. Charlie is targeted. The destination of Charlie is Cubicle Three. The Turn Frequency of Charlie is 3.
        A door called the Glass Doors is east of the Entrance and west of the Sale Hall. The glass doors are closed and unlocked. The glass doors are scenery.
        The Fitting Rooms is a region.
        Cubicle One is a room in the Fitting Rooms. Cubicle One is east of the Sale Hall. "A simple cubicle for trying on clothes before purchasing them."
        Cubicle Two is a room in the Fitting Rooms. Cubicle Two is southeast of the Sale Hall. "A simple cubicle for trying on clothes before purchasing them."
        Cubicle Three is a room in the Fitting Rooms. Cubicle Three is south of the Sale Hall. "A simple cubicle for trying on clothes before purchasing them."
        When play begins:
            Now Reporting is Collective.
        After opening the doors for the first time:
            say "You are nearly knocked over as the bargain hunters stampede into the store.";
            activate Amy;
            activate Beth;
            activate Charlie.
        The move patrollers rule response (D) is "[The Bod] [go] [way] to [NextRoom] to try on [one of]a satin evening dress[or]a cashmere shawl[or]a pair of Lycra running shorts[or]a pair of high heel boots[at random]."
        Instead of going west from the Sale Hall when the Glass Doors are open:
            say "You cannot leave the store whilst the sales are on."
        Instead of going to Cubicle One when the number of patrollers in Cubicle One is greater than 0:
            say "You cannot enter a fitting room when it is occupied."
        Instead of going to Cubicle Two when the number of patrollers in Cubicle Two is greater than 0:
            say "You cannot enter a fitting room when it is occupied."
        Instead of going to Cubicle Three when the number of patrollers in Cubicle Three is greater than 0:
            say "You cannot enter a fitting room when it is occupied."
        Every turn when the location is the Sale Hall:
            let count be the number of patrollers in the Sale Hall;
            if count is greater than 0:
                now Reporting is Individual;
                if count is 1, say "[list of patrollers in the Sale Hall] rummages for a bargain.";
                if count is greater than 1, say "[list of patrollers in the Sale Hall] are rummaging for bargains.".
        Test me with "open doors / wait / wait / wait / w / e"