Ensure house map maze with lifts can be solved?
Posted
by
Philipp Lenssen
on Game Development
See other posts from Game Development
or by Philipp Lenssen
Published on 2012-03-03T23:09:23Z
Indexed on
2012/12/13
17:18 UTC
Read the original article
Hit count: 393
In my game we see the floors of a house from the side, and the hero can take lifts -- a lift either goes up (to the next lift upwards), or down (to the next lift downwards), depending on the arrow as shown, and there's always a pair of exactly two lifts connected. That's the only way the hero can move vertically, though he can freely move horizontally. The house map is a randomized 11x5 grid with different items, and unpassable walls to the far left, far right, and sometimes in one of the two middle positions:
My question: How can I ensure the map is always randomized yet always solvable and that the hero, starting at the left side of the bottom floor, can always leave it via any upwards-pointing lift at the top floor?
For what it's worth I'm using the Lua language for development. Thanks so much!
© Game Development or respective owner