|
jed Adept
Joined: 18 Dec 2005 Posts: 246
|
Posted: Thu Aug 10, 2006 4:18 am
Finding location within a map of rooms with same description |
I play a mud that has a deathmaze, so when you die you pop into the "maze" this maze is actually one of two (randomly selected) areas having the same map, you just have to figure out where you are and on which map. I do this manually by mapping the room that I am in, then moving about 5 rooms or so, each time drawing a manual map, then I match the pattern on that map to the pattern on the maze, and once I identify the room, I set it as my location. The exit to the maze is found when you find a room that has a down exit which moves each time you enter the maze. Also for kicks, every room has the same description and title, only the exits change. SOO I am looking to write a script that when popped in the maze will look at the exits of the room I am in, pick one, move that direction and keep a temporary map (graphical or in variables) of where I have been, then match it up to the mud itself and set my location when it identifies where I am. Any thoughts on how a guy might do this?
|
|
|
|
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Fri Aug 11, 2006 11:29 am |
Here's something off the top of my head. It's all possible using variables, as I've done something similar to what you're doing, although I had more then just exits to work with.
It's basically a case of filtering all rooms continuously until you end up with only one possibilty.
Filter 1: The first filter I would apply is the number of exits that are in your start position. Loop through all the active rooms (all of them at this stage) in both maze maps and eliminate the rooms which do not match the number of exits.
Filter 2: Loop through all rooms and eliminate the rooms which do not have matching exits.
Begin Loop
Step 1: Now you move in a direction of your choice and record the direction. (Lets say you move East)
Do Filter 1 and 2 again.
Filter 3: Loop through all active rooms and eliminate any which DO NOT have an Active room 1 West of them
End Loop
Keep going until you're left with only one active room.
When moving in a direction I would make sure that you don't go back the way you came.
It may also be worth while studying both mazes and determining manually a 'set' of directions that will give the best results. This is especially true if you make use of relational directions (forward,backward,left,right) instead of the standard cardinal directions (north,south,east,west) that most muds operate on. It isn't too hard to create an alias which automatically converts cardinal directions to relational directions and vice-versa.
I hope it helps. |
|
_________________ That which does not kill us, makes us stronger. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|