I have a task in hand about making a puzzle generator, that can fill a game board with colored pearls, that then needs to be solved by the player.
The core rules are
- Pearls are placed in a grid, size varying each level.
- The player needs to clear out all the pearls, or the level is lost.
- Only three pearls in a row (adjacent to each other) can be popped.
- Popping 7 or more will pop each pearl of that color, easing up the board quite a lot.
- Pearls are affected by gravity, and will fall down on the cleared pearls place.
- No new pearls are spawned.
I also need two levers to adjust difficulty. One being the number of colors the pearls can have (clear to the player) and another being a "cruelty" factor in how tight the spectrum of right solutions vs dead ends the level contains.
I seem to be at a crossroad between two ways of approaching this, and would like feedback from you gents and gals.
My two options seems to be :
- Start out with a clean board, and programmatically add pearls-combos to the board till its full. Then the player needs to track backwards from there to solve it. (They wont see it actually being generated, this will happend backstage) This should ensure that a board always have at least one solution, which is backtracking how the engine placed the pearls in the first place.
- Making a pure random board, and then set a scripted runner to try and solve it, branching every time there are more than poppable option, and starting over on a new board if all branches leads to a dead end. This should give me a good result about how many dead ends vs solutions the board contains.
Im not sure which is the best approach, or if I got it all wrong and need to go for a third approach to this. Admittedly, this is my first attempt on a puzzle game mechanics.