Beispiel #1
0
 /// <summary>
 /// Check X,Y coordinate
 /// </summary>
 /// <param name="position"></param>
 /// <returns>If coorditane has a rover returns true</returns>
 public bool CheckCoordinate(Position position)
 {
     return(
         position.X > Size.Width ||
         position.X < 0 ||
         position.Y > Size.Height ||
         position.Y < 0 ||
         RoversPosition.Exists(p => p.X == position.X && p.Y == position.Y));
 }
Beispiel #2
0
 public bool SetRoverLocation(Position position)
 {
     if (AcceptNextLanding)
     {
         if (CheckCoordinate(position))
         {
             AcceptNextLanding = false;
             return(false);
         }
         else
         {
             RoversPosition.Add(position);
             AcceptNextLanding = true;
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }