I am looking to create a Suguru game for the Arduboy.
As part of this, I am trying to work out the best approach to generate puzzles. I have am assuming a number of things:
- fixed puzzle sizes, maybe 8x6, 10x7, 12 x8. Actual sizes might be restricted by the screen resolution and graphics I choose!
- predetermined layouts for the blocks. I am hoping to have many layouts per puzzle size stored in PROGMEM for variety.
So, the question is how to generate these.
I am assuming I will start by populating a complete puzzle then removing pieces to obtain a starting point.
I can do it using a ‘brute force’ approach across the entire board or (more likely) by progressing from one block to another by randomly placing the tiles and then comparing the placement against the previously placed blocks. If a block cannot be populated randomly, then entire process is aborted and the started again.
This might end up in an endless loop! Does anyone have any other ideas on how to populate the board?
Once populated, I can then remove pieces to work back to a starting point … but how to do that logically so that the puzzle has enough detail to allow someone to solve it?