Since the rooms are always in the same order in the exit lists, we can make a quick map of the rooms while looking for an exit.
My pseudo code is somewhat Javaish, sorry, I've been using it a lot lately.
Unvisited_Rooms is a hashmap holding a room ID, and a list of indexes of the un-mapped rooms Or a 2d array, whatever works.
I imagine the algorithm could go something like this:
Unvisited_Rooms.add(currentRoom.ID, currentRoom.exits) //add the starting room exits
while(Unvisited_Rooms.Keys.Count > 0 && currentRoom != end) //keep going while there are unmapped exits and we're not at the end
Room1 = currentRoom
ExitID = Room1.get_first_unmapped_Room() //returns the index of the first unmapped room
if(ExitID == -1) //this room didn't have any more unmapped rooms, it's totally mapped
PathTo(Get_Next_Room_With_Unmapped_Exits) //we need to go to a room with unmapped exits
continue //we need to start over once we're there, so we don't create false links
GoToExit(ExitID) //goes to the room, setting current room to the room on the other side
Room1.Exits[exitID].connection = currentRoom.ID //maps the connection for later path finding
Unvisited_Rooms[Room1.ID].remove(exitID) //removes the index so we don't worry about it
if(Unvisited_Rooms[Room1.ID].size < 1) //checks if all the rooms exits have been accounted for
Unvisited_Rooms.remove(Room1.ID) //removes the room if it's exits are all mapped
Unvisited_Rooms.add(currentRoom.ID, currentRoom.unvisited_exits) //adds more exits to the list
If(currentRoom != end && Unvisited_Rooms.Keys.Count < 1)
print(No exit found!)
else
print(exit is roomID: currentRoom.ID)
You'll need to use one of the common node path finders to PathTo() rooms across "the map" Hopefully that's clear enough to get you started on something.