public void moveActor(IActor actor, int i) { int yDiff = 0; int xDiff = 0; if (i < 4) yDiff = -1; else if (i > 6) yDiff = 1; if (i % 3 == 1) xDiff = -1; else if (i % 3 == 0) xDiff = 1; int newX, newY; newX = Math.Min(Math.Max(0, actor.position().X + xDiff), xSize - 1); newY = Math.Min(Math.Max(0, actor.position().Y + yDiff), ySize - 1); //if (newX != actor.position().X + xDiff || newY != actor.position().Y + yDiff) // actor.fitness *= 1.1f; actor.setPosition(newX,newY ); }