Automatic generation of puzzles