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