Example #1
0
        private bool IsNextMoveOutOfGrid(char command)
        {
            if (command == 'M')
            {
                switch (_direction)
                {
                case Direction.N:
                    return(y >= grid.UpperY());

                case Direction.E:
                    return(x >= grid.UpperX());

                case Direction.S:
                    return(y <= 0);

                case Direction.W:
                    return(x <= 0);
                }
            }
            return(false);
        }