Exemplo n.º 1
0
 public Cordinate <T> ComputeNewCordinate(Cordinate <T> cordinate, U step, IMoveArea <T> moveArea, IDirection <T, U> direction)
 {
     //determine the move direction
     return(direction.Move(cordinate, step, moveArea.Width, moveArea.Height));
 }
Exemplo n.º 2
0
        public static void IsCordinateValid <T>(RoboPlacementCommandSegment commandSegments, IMoveArea <T> moveArea)
        {
            var coordX = (T)Convert.ChangeType(commandSegments.X, typeof(T));
            var coordY = (T)Convert.ChangeType(commandSegments.Y, typeof(T));

            if ((dynamic)coordX < 0)
            {
                throw new ArgumentException($"Invalid X Position");
            }

            if ((dynamic)coordY < 0)
            {
                throw new ArgumentException($"Invalid Y Position");
            }

            if ((dynamic)coordX > (dynamic)moveArea.Width)
            {
                throw new ArgumentException($"Invalid X Position");
            }

            if ((dynamic)coordY > (dynamic)moveArea.Height)
            {
                throw new ArgumentException($"Invalid Y Position");
            }
        }
Exemplo n.º 3
0
 public Cordinate <T> ComputeNewCordinate(Cordinate <T> cordinate, U step, IMoveArea <T> moveArea, IDirection <T, U> direction)
 {
     return(cordinate);
 }
Exemplo n.º 4
0
 public Robo(IMoveArea <T> moveArea)
 {
     MoveArea = moveArea;
 }