Algorithm for randomly creating an Amaze level - what makes it beatable?

119 Views Asked by At

For those of you who are not familiar with Amaze, here is some footage which will probably explain it better than I ever could: https://youtu.be/_puK8GS0-mA?t=192

For fun, I recreated it in a console application. I got the simple game mechanics to work correctly; it wasn't very difficult. I intended to also make a random level generator, but I realized that I don't know how to guarantee that it can be completed. My current method of level creation is very random, and leaves various areas that can't be reached because of situations like this,

# # # # # # #
# x - - - - #
# # # - # # #
# # # - # # #
# # # # # # #

where 'x' is the player, '#' is a wall, and '-' is open. You can never reach the bottom branch, but at the moment, my level generating code doesn't know that.

How could you make an algorithm that would know that the level it is creating is 100 percent beatable (i.e. you could reach every '-') and would be perfectly scalable?

Sorry for the lack of terminology. Thanks for reading.

Also, am I posting in the right place?