Patrollers

version 12 by Michael Callaghan

  • Home page
  • Beginning
  • Previous



  • Section 4.2 - Validation
    When play begins (this is the validate patrollers rule):
        repeat with Bod running through Patrollers:
            if the Bod is RoomLed and the RoomTable of the Bod is Table of NoRooms:
                say "[Patroller Error]";
                say "You have created a RoomLed Patroller without a RoomTable.[paragraph break]";
                say "[Correct Code]";
                Terminate;
            if the Bod is DirectionLed and the DirectionTable of the Bod is Table of NoDirections:
                say "[Patroller Error]";
                say "You have created a DirectionLed Patroller without a DirectionTable.[paragraph break]";
                say "[Correct Code]";
                Terminate;
            if the Bod is Targeted and the Destination of the Bod is not a room:
                say "[Patroller Error]";
                say "You have created a Targeted Patroller without a Destination or with a Destination that is not a room.[paragraph break]";
                say "[Correct Code]";
                Terminate;
            if the Drive of the Bod is less than 0 or the Drive of the Bod is greater than 100:
                say "[Patroller Error]";
                say "You have created a Patroller with a Drive that is outside the range 0 to 100.[paragraph break]";
                say "[Correct Code]";
                Terminate;
            if the Turn Frequency of the Bod is less than 1:
                say "[Patroller Error]";
                say "You have created a Patroller with a Turn Frequency that is less than 1.[paragraph break]";
                say "[Correct Code]";
                Terminate;
    Patrollers ends here.