Patrollers

version 12 by Michael Callaghan

  • Home page
  • Beginning
  • Previous



  • Example: ** Border Dispute - A short example to show setting regions off-limits to patrollers
        "Border Dispute" by Michael Callaghan
        Include Patrollers by Michael Callaghan.
        Balonia is a region. Tripea is a region.
        The Observation Post is a room. "You have been here for days watching for border disputes between Balonia and Tripea. Any territorial incursion by the countries' respective guards could bring about a nasty war. It is with some trepidation that you watch the guard wander around the border zone."
        Hilltop is a room in Balonia.
        Empty meadow is a room in Balonia.
        Control point is a room in Balonia.
        West border crossing is a room in Balonia.
        Rolling plains is a room in Tripea.
        Rough terrain is a room in Tripea.
        East border crossing is a room in Tripea.
        Commanding Heights is a room in Tripea.
        Empty meadow is east of Hilltop. Control point is south of Hilltop. West border crossing is southeast of Hilltop.
        Control point is southwest of Empty meadow. Control point is west of West border crossing. West border crossing is south of Empty meadow.
        Rough terrain is east of Rolling plains. East border crossing is south of Rolling plains. Commanding Heights is southeast of Rolling plains.
        Rough terrain is northeast of East border crossing. Rough terrain is north of Commanding Heights. Commanding Heights is east of East border crossing.
        Rolling plains is east of Empty meadow. East border crossing is east of West border crossing. East border crossing is southeast of Empty meadow. Rolling plains is northeast of West border crossing.
        The Balonian Guard is a patroller in Hilltop. The Tripean Guard is a patroller in Rolling plains.
        The Tripean Guard is aimless. The Balonian Guard is aimless.
        When play begins:
            activate the Tripean Guard;
            activate the Balonian Guard.
        Every turn:
            say "You note that the Tripean Guard is in the [the location of the Tripean Guard] in [map region of the location of the Tripean Guard] and the Balonian Guard is in the [the location of the Balonian Guard] in [map region of the location of the Balonian Guard]. ";
            if the map region of the location of the Balonian Guard is Tripea:
                say "It looks like Balonia has invaded Tripea. All hell is likely to break loose any time soon. ";
            if the map region of the location of the Tripean Guard is Balonia:
                say "It looks like Tripea has invaded Balonia. Standby for fireworks. ";
            if the location of the Balonian Guard is adjacent to the location of the Tripean Guard:
                say "The two guards eyeball each other across the border, but neither is willing to enter the other's territory. You breath a sigh of relief. ";
            say "[paragraph break]".
        To decide if (R - a Room) is off-limits to (P - a Patroller):
            if P is the Balonian Guard:
                if the map region of R is Balonia:
                    decide no;
                decide yes;
            if P is the Tripean Guard:
                if the map region of R is Tripea:
                    decide no;
                decide yes;
            decide no.
        Test me with "z /z /z/z/z/z/z/z/z/z/z/z".