Sounds like the sliding puzzle from Castlevania DS:
But it sounds like the difference here may be that instead of having
n panels outright, you have to find the panels throughout the game. Then you can move around the panels that you have found such that you create useable paths elsewhere. Am I right?
Well, first off you need to design your sliding puzzle in full. Your puzzle will have a complete solution, so design that first (remember to leave one panel empty). There's a sliding puzzle tutorial on the old forums that I made. It's pretty comprehensive, too. They seem easy to make, but they can be actually quite difficult depending on how you decide to program them.
Assign numerical values to each piece, just like in the image above. Now design your rooms for each of those pieces and put the rooms in the same numerical order. If you don't trust GM's internal mechanics, you can assign each room index to an array of all the rooms in the solution. You don't actually need an array of the solution to compare to if you don't want to notify the player that he got all the pieces in the right order, however you will need an array holding the current layout of the room.
Furthermore, you will want an array that defines the pathways of each room. You'd use some fancy bit manipulation to keep track of that. So let's take the CVDS puzzle map as it is completed:
Ooh, those tricky buggers -- four of the rooms don't even connect! Anyway, the first room has exits on the left and right. We can denote this numerically as a value of 5. Room 2 has exits at the left and bottom. We can denote this numerically as a value of 12. Room 3 has exits on the right and down, which would thus be 9 following the same pattern. In other words, 1 = right, 2 = up, 4 = left, and 8 = down. You add them together to get the value of the room.
puzzle_room[0] = 5;
puzzle_room[1] = 12;
puzzle_room[2] = 9;
puzzle_room[3] = 5;
puzzle_room[4] = 1;
puzzle_room{5] = 11;
puzzle_room[6] = 14;
puzzle_room[7] = 8;
and so on.
You'll store the player's "position in the puzzle" in a variable. When the player enters a room, check its doorway value (the value in the exits array). For each of the directions, check if the next room in that direction has the opposite door value. If no room exists, lock the door. If the adjacent room has the wrong value, lock the door.