An User2d is created by sampling a resistance probability and energy budget using the newEffort method. A repeating schedule is created to call the stepAgent method every time step.
This method samples selects a uniformly-distributed direction and an energy budget via the inherited sampleEnergy method.
Whenever a Swarm has internal Schedules, ActionGroups, or Swarms it is necessary to activate them inside the Swarm. Here the repeating schedule is associated with the Swarm.
The step method selects a color based on the frobbed/resisting status flags (white for touring, gray for resisting, and dark gray for listening), moves the agent in the current direction, and then decrements the energy budget. If the there is no more energy, a new direction and energy budget is selected. Finally, it clears the frobbed/resisting flags.