I'm making a maze generator that uses Eller's algorithm. There's not much information about this particlar algorithm on the Internet. So I have some things misunderstood about it. I've made a picture to show you the proccess of generating an incorrect maze.

enter image description here

I didn't found any information about this in article1 and article2.

What should I do to avoid generating loops?

  • 1
    $\begingroup$ I'm not sure what your question is, here. If the algorithm generates cycle-free mazes and you have a cycle, then isn't the answer just "implement it correctly"? $\endgroup$ – David Richerby Oct 4 '18 at 12:40
  • $\begingroup$ @DavidRicherby as you can see in the image, I do everything those articles say. But anyway, sometimes I get loop. Sometimes I don't. $\endgroup$ – sovel2 Oct 4 '18 at 13:06

here I get two blocks of the same set, but they don't go one after the other. So I join the second one go it's own unique set

Don't do that; this is not a step mentioned in your first reference! Two cells are in the same set when there is already a path between them (by going up though the already generated portion). By arbitrarily placing the second block into a new set, you are ignoring the fact that it is connected to other cells.

When you leave the 3 blocks alone, you will get

(03 17)03
 03(03 03)

You are required to place a wall between two blocks of the same set, because they already have a path between them. Thus you produce

 03 03|03

And don't had a loop.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.