sraaphorst / spelunker

Maze generation and solving library
Other
11 stars 2 forks source link

Braiding bug #119

Closed sraaphorst closed 6 years ago

sraaphorst commented 6 years ago

There is a bug in braiding that, when a maze has no dead ends, causes an exception to be thrown. I suspect this is because braiding doesn't check before proceeding that there are dead ends.

It is easily reproduced in either of the following ways for a Maze m:

  1. m.braidAll().braidAll()
  2. m.makeUnicursal().braidAll()
sraaphorst commented 6 years ago

The problem turned out to be in RNG.shuffle when trying to shuffle an empty collection. I was previously performing a subtraction on the size method, which returns an unsigned integer type.