version 12 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Specifying the frequency of a Patroller's moves
    We can specify whether a patroller moves every turn, every other turn, etc, by setting the Turn Frequency of the Patroller. A Turn Frequency of 1 means that the Patroller will try to move every turn while On Patrol, a Turn Frequency of 2 means every other turn, a Turn Frequency of 3 means every third turn, and so on. The default setting is 1, which means that a Patroller will always try to move every turn unless we actively set the Turn Frequency to another value.
        The Sightseer is a Patroller in the Quadrangle. The Turn Frequency of the Sightseer is 4.
    A patroller will always try to move on the first turn when the patroller is On Patrol.
    If we set the Turn Frequency to a number below 1, error checking routines will reset the Turn Frequency to 1 to prevent division by zero errors at runtime.