social_learning.World.applyToroidalAgentLocationRules C# (CSharp) Method

applyToroidalAgentLocationRules() private method

Forces the agent to stay on screen by wrapping them around the other side of the world if they run over an edge.
private applyToroidalAgentLocationRules ( IAgent agent ) : void
agent IAgent
return void
        private void applyToroidalAgentLocationRules(IAgent agent)
        {
            if (agent.X >= Width)
                agent.X -= Width;
            if (agent.Y > Height)
                agent.Y -= Height;
            if (agent.X < 0)
                agent.X += Width;
            if (agent.Y < 0)
                agent.Y += Height;
        }