Пример #1
0
        public Robot(IWarehouse warehouse, int startX, int startY, char startOrientation)
        {
            const string compassPoints = "NESW";
            if (!compassPoints.Contains(startOrientation))
            {
                throw new Exception("Invalid orientation");
            }

            if (!warehouse.IsValidCoordinate(startX, startY))
            {
                throw new Exception("Invalid position");
            }

            _warehouse = warehouse;
            _x = startX;
            _y = startY;
            _orientation = startOrientation;
        }