sraaphorst / spelunker

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

T54: Added storing of grid colour seeds to avoid repeats using Show. #57

Closed sraaphorst closed 6 years ago

sraaphorst commented 6 years ago

As it turns out, the partitioning algorithm was leading, through our filtering requirements, to many equivalent values. (An extreme case: 5 1 2 generated 17,360 configurations, but only 340 of them are unique.)

I implemented a Show typeclass instance for CandidateConfiguration that encodes in base-64, which should be sufficient because even low numbers of colours, e.g. 10, are time consuming to handle. CandidateConfigurations are now converted into strings and stored in a set to check for repetitions, in which case, we discard them.