Esempio n. 1
0
 public GridPoint AdvanceWest(GridPoint fromPosition)
 {
     return((fromPosition.X == 0)
         ? new GridPoint(MaxX - 1, fromPosition.Y)
         : new GridPoint(fromPosition.X - 1, fromPosition.Y));
 }
Esempio n. 2
0
 public GridPoint AdvanceEast(GridPoint fromPosition)
 {
     return((fromPosition.X + 1 == MaxX)
         ? new GridPoint(0, fromPosition.Y)
         : new GridPoint(fromPosition.X + 1, fromPosition.Y));
 }
Esempio n. 3
0
 public GridPoint AdvanceNorth(GridPoint fromPosition)
 {
     return((fromPosition.Y + 1 == MaxY)
         ? new GridPoint(fromPosition.X, 0)
         : new GridPoint(fromPosition.X, fromPosition.Y + 1));
 }
Esempio n. 4
0
 public GridPoint AdvanceSouth(GridPoint fromPosition)
 {
     return((fromPosition.Y == 0)
         ? new GridPoint(fromPosition.X, MaxY - 1)
         : new GridPoint(fromPosition.X, fromPosition.Y - 1));
 }
Esempio n. 5
0
 public bool ObstacleExists(GridPoint position)
 {
     return(Obstacles.Any(obstacle => obstacle.X == position.X && obstacle.Y == position.Y));
 }