« on: January 16, 2008, 02:06 AM »
Thank you very much for the feedback.
Yes, every puzzle can be solved purely from the clues shown!
The trick is to get used to what the clues really represent - you often need to re-check certain clues once another tile has been discovered.
The puzzles are created using an approach that I thought up myself, although not saying I'm the first person in the world to come up with it!
It's a bit tricky to explain, but here's the gist:
First select the tiles which represent the final solution, and store in a linked list. This list is shuffled around so that each clue, when created, tends to reference tiles in different rows/columns, for extra confusion ;-)
Then simply create a randomly selected type of clue to connect each tile with its neighbour. This guarantees the puzzle is always solvable without guessing. To make life harder I have a second loop around to see if any clues are superfluous, or can be combined.
All-in-all the generator is about 400 lines of Delphi, and is reasonably generic: I wrote another game using a similar algorithm which I'll post shortly if anyone is interested.