Exemple #1
0
        bool _make_move(int direction)
        {
            if (isRoomInDirectionFree(current_pos, direction))
            {
                Position           next_pos     = current_pos.GetBiasedPosition(direction);
                maze_room_internal current_room = getRoom(current_pos);
                maze_room_internal next_room    = getRoom(next_pos);
                maze_move          move         = new maze_move(current_pos, next_pos, direction);
                CriticalPath.Add(move);
                counter++;
                next_room.Visited(counter);
                next_room.isOnCriticalPath         = true;
                current_room.directions[direction] = 1;
                next_room.directions[Direction.GetOppositeDirection(direction)] = 2;
                current_pos = next_pos;
                return(true);
            }

            return(false);
        }
Exemple #2
0
 void _undo_move(int count = 1)
 {
     for (int i = 0; i < count; i++)
     {
         maze_move move = CriticalPath[CriticalPath.Count - 1];
         CriticalPath.Remove(CriticalPath[CriticalPath.Count - 1]);
         maze_room_internal current_room = getRoom(move.pos_from);
         maze_room_internal next_room    = getRoom(move.pos_to);
         int opposite_direction          = Direction.GetOppositeDirection(move.direction);
         if (next_room.isVisited != 0)                                                                                                   // Utter guesswork, but really the only thing that could make sense.
         {
             current_room.directions[move.direction]  = 0;
             next_room.directions[opposite_direction] = 0;
             next_room.isVisited        = 0;
             next_room.isOnCriticalPath = false;
             counter -= 1;
         }
         current_pos = current_pos.GetBiasedPosition(opposite_direction);
     }
 }
Exemple #3
0
        bool _make_move(int direction)
        {
            if (isRoomInDirectionFree(current_pos, direction))
            {
                Position next_pos = current_pos.GetBiasedPosition(direction);
                maze_room_internal current_room = getRoom(current_pos);
                maze_room_internal next_room = getRoom(next_pos);
                maze_move move = new maze_move(current_pos, next_pos, direction);
                CriticalPath.Add(move);
                counter++;
                next_room.Visited(counter);
                next_room.isOnCriticalPath = true;
                current_room.directions[direction] = 1;
                next_room.directions[Direction.GetOppositeDirection(direction)] = 2;
                current_pos = next_pos;
                return true;
            }

            return false;
        }