Esempio n. 1
0
        public void SetPosition(int x, int y, string direction)
        {
            if (x < 0)
            {
                throw new ArgumentException("Invalid x value");
            }

            if (y < 0)
            {
                throw new ArgumentException("Invalid y value");
            }

            if (Plateau.GridMaxX > 0 && x > Plateau.GridMaxX)
            {
                throw new ArgumentException("Invalid x value");
            }

            if (Plateau.GridMaxY > 0 && y > Plateau.GridMaxY)
            {
                throw new ArgumentException("Invalid y value");
            }


            X         = x;
            Y         = y;
            Direction = DirectionParser.ParseString(direction);
        }
Esempio n. 2
0
 public override string ToString()
 {
     return($"{X} {Y} {DirectionParser.GetString(Direction)}");
 }