Sunday, July 23, 2017

How to build pattern search puzzles


This is a question about puzzle-building. I very much enjoyed (albeit not solved) the puzzle Find the missing elephants by GOTO 0. And, as it is often the case with intriguing puzzles, it sparked some ideas of my own. (No need to worry, I'm not planning to put tons of clones online anytime soon...)


However, I then asked myself: How does one best build and verify such puzzles? Simple kernel-convolution puzzles I would have a good idea how to build & test, but anything with a complex conditional like in this particular puzzle, I don't know.


What tools/methods are you using/would you use to build such puzzles?



Answer



I cannot give any general recommendations on how to create great puzzles, but I'm glad to explain how the particular puzzle mentioned in the question was made.


The elephant puzzle was built (you guessed it) with a computer program: I tried out a few different algorithms before coming up with one that seemed good enough to make a puzzle.


Random numbers are produced with a seeded random number generator: this makes sure that we can always replay an interesting arrangement after we find one.


The board is created in three successive steps. First, all directions are set up randomly. Next, each row is scanned and cells are partitioned in subsets of color-matching elephants, ehm, elements. Each of these subsets is assigned a different color, chosen randomly from a palette of four colors. The last step is the rendering. This is done in Javascript/HTML. Just grab a screenshot and use GIMP to export the board.


The source code of the generator can be found here: https://github.com/fasttime/Elephant-Puzzle-Maker



No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...