# Patrollers

## version 12 by Michael Callaghan

Section 3.4 - After moving the Patroller
After Patrolling something (called the Bod) (this is the update route for patrollers rule):
[Rules for Patrollers that have route tables.]
if the Bod is a RoomLed Patroller or the Bod is a DirectionLed Patroller:
[Only update information if the Patroller moved.]
if the Location of the Bod is not the CurrentRoom:
[Rules for Patrollers that are Outward Bound.]
if the Bod is OutwardBound:
[Increase the PathStage of the Patroller.]
increase the PathStage of the Bod by 1;
[Determine what happens if the Patroller is at the end of the route.]
if the PathStage of the Bod is greater than the PathLength of the Bod:
[OneWay Patrollers stop at the end of their route.]
if the Bod is OneWay, now the Bod is Off Patrol;
[TwoWay and TwoWayRepeated Patrollers retrace their route.]
if the Bod is TwoWay or the Bod is TwoWayRepeated:
[Set the Patroller to retrace the route.]
now the Bod is InwardBound;
[Set the correct stage on the route for the Patroller.]
if the Bod is RoomLed:
now the PathStage of the Bod is the PathLength of the Bod minus 1;
if the Bod is DirectionLed:
now the PathStage of the Bod is the PathLength of the Bod;
[Circular Patrollers return to the beginning of their route.]
if the Bod is Circular:
now the PathStage of the Bod is 1;
otherwise:
[Rules for Patrollers that are InwardBound.]
[Decrease the PathStage of the Patroller.]
decrease the PathStage of the Bod by 1;
[Determine what happens if the Patroller is at the beginning of the route.]
if the PathStage of the Bod is 0:
[TwoWay Patrollers stop when they arrive back at the beginning of their route.]
if the Bod is TwoWay:
now the Bod is Off Patrol;
[TwoWayRepeated Patrollers start the route all over again.]
if the Bod is TwoWayRepeated:
[Set the correct stage on the route for the Patroller.]
if the Bod is RoomLed:
now the PathStage of the Bod is 2;
if the Bod is DirectionLed:
now the PathStage of the Bod is 1;
now the Bod is OutwardBound.
After Patrolling something (called the Bod) (this is the reclose doors for patrollers rule):
if the Bod is a Patroller:
if the location of the Bod is not the CurrentRoom:
if the ReclosingCapability of the Bod is reinstate:
if the Obstacle is an openable door:
if ObstacleClosed is true and ObstacleLocked is true:
now the Obstacle is closed;
now the Obstacle is locked;
if the CurrentRoom is the location of the player and Reporting is Individual:
say "[The Bod] [close] and [lock] [the Obstacle]." (A);
if the NextRoom is the location of the player and Reporting is Individual:
say "[text of reclose doors for patrollers rule response (A)]";
if ObstacleClosed is true and ObstacleLocked is false:
now the Obstacle is closed;
if the CurrentRoom is the location of the player and Reporting is Individual:
say "[The Bod] [close] [the Obstacle]." (B);
if the NextRoom is the location of the player and Reporting is Individual:
say "[text of reclose doors for patrollers rule response (B)]";.
After Patrolling something (called the Bod) (this is the reached destination for targeted patrollers rule):
if the Bod is a Targeted Patroller and the location of the Bod is the Destination of the Bod:
now the Bod is Off Patrol.