Пример #1
0
        private bool MakeMove(int direction)
        {
            if (this.IsRoomInDirectionFree(_currentPos, direction))
            {
                var nextPos     = _currentPos.GetBiasedPosition(direction);
                var currentRoom = this.GetRoom(_currentPos);
                var nextRoom    = this.GetRoom(nextPos);
                var move        = new MazeMove(_currentPos, nextPos, direction);

                this.CriticalPath.Add(move);

                _counter++;

                nextRoom.VisitedCount     = _counter;
                nextRoom.IsOnCriticalPath = true;

                currentRoom.Directions[direction] = 1;
                nextRoom.Directions[Direction.GetOppositeDirection(direction)] = 2;

                _currentPos = nextPos;

                return(true);
            }

            return(false);
        }
Пример #2
0
		private bool MakeMove(int direction)
		{
			if (this.IsRoomInDirectionFree(_currentPos, direction))
			{
				var nextPos = _currentPos.GetBiasedPosition(direction);
				var currentRoom = this.GetRoom(_currentPos);
				var nextRoom = this.GetRoom(nextPos);
				var move = new MazeMove(_currentPos, nextPos, direction);

				this.CriticalPath.Add(move);

				_counter++;

				nextRoom.VisitedCount = _counter;
				nextRoom.IsOnCriticalPath = true;

				currentRoom.Directions[direction] = 1;
				nextRoom.Directions[Direction.GetOppositeDirection(direction)] = 2;

				_currentPos = nextPos;

				return true;
			}

			return false;
		}