You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes level generation takes an infinite amount of time because something that it is trying to do is actually impossible, regardless of how many times we loop. To fix this, we need to pass in a number of attempts to the MapGenerator and replace our loop statements with limited loops. When we reach the limit, we should return an Err to indicate that something failed. When such an error propagates up, we should use the same rng to generate another MapKey and then try again using that.
A consequence of this strategy is that some MapKeys will actually collide with other MapKeys. Not a huge deal though because we aren't doing cryptograph hashing. It's more important that we actually eventually return a map and do not loop forever.
We should fatally error if 5 MapKeys don't work in succession. That would be a hell of an edge case...
The text was updated successfully, but these errors were encountered:
Sometimes level generation takes an infinite amount of time because something that it is trying to do is actually impossible, regardless of how many times we loop. To fix this, we need to pass in a number of attempts to the
MapGenerator
and replace ourloop
statements with limited loops. When we reach the limit, we should return anErr
to indicate that something failed. When such an error propagates up, we should use the same rng to generate anotherMapKey
and then try again using that.A consequence of this strategy is that some
MapKey
s will actually collide with otherMapKey
s. Not a huge deal though because we aren't doing cryptograph hashing. It's more important that we actually eventually return a map and do not loop forever.We should fatally error if 5
MapKey
s don't work in succession. That would be a hell of an edge case...The text was updated successfully, but these errors were encountered: