Ejemplo n.º 1
0
        public void CreateRover(IPlateau plateau, Point point, Direction direction)
        {
            plateau.CheckPosition(point);

            Position  = point;
            Direction = direction;
            _wing     = _wingList.FirstOrDefault(x => x.Direction == direction);
            _isCreate = true;
        }
Ejemplo n.º 2
0
        public Rover()
        {
            _movementMethodDictionary = new Dictionary <Movement, Action>
            {
                { Movement.Forward, () => SetPosition(_wing.Move(Position)) },
                { Movement.Left, () => _wing = _wing.TurnLeft() },
                { Movement.Right, () => _wing = _wing.TurnRight() }
            };

            _wingList = new List <IWing>()
            {
                new NorthWing(),
                new EastWing(),
                new WestWing(),
                new SouthWing()
            };
        }