Skip to content

My puzzle generator couldn't make hard puzzles until I let it move the stars

I've been making a hex logic puzzle for Android called Asterism. Numbers count the stars around them, a bit like Minesweeper, except there are no mines and you should never have to guess. The campaign is hand-made, but the endless mode (Deep Sky) is generated, a bit over 2,000 puzzles so far.

The generator goes roughly like this. Scatter some stars, throw away layouts that look unnatural (long straight runs, tight clumps), write every clue there is. Then simulated annealing decides what to actually show: each clue can stay, change form, or be hidden, line clues can be switched off, and it picks which hexes start open. Every candidate gets solved by a solver that's only allowed to use deductions a person would make, and gets scored against a target band for that difficulty.

For a long time the stars were fixed and only the clues moved. For the plain counting rules that turned out to be a hard ceiling: on the deep difficulty more than half the skies never got into the band, they just got "close", and I shipped the close ones with a flag. No amount of clue tweaking helps if the stars themselves only allow easy deductions.

So now the annealer can move stars too. The fiddly part is that some rules constrain the sky: mirror skies have to move a star together with its reflection, the paired-stars rule has to move a whole pair to a spot where it touches nothing else, and line clues have to be recounted after every move. I also had to add the naturalness penalties into the score, because the first version happily clumped everything together.

On a side-by-side rebuild of 60 existing puzzles it went from 46 to 57 in the target band. Most came out as hard or harder. The paired-stars rule at the top difficulty got a bit easier, still inside the band.

The thing I measure that ended up mattering most: how many moves you could make at each point of the solve, computed exactly. It says more about how a puzzle feels than how hard its hardest step is. Curious what other people use to measure difficulty in generated puzzles.

The game, if you want to see it: https://play.google.com/store/apps/details?id=com.tobkum.asterism

0 points0 comments
Open on Reddit
About this post
Posted
Archived
Score
0 · 50% up
Kind
Text
ID
1xqcod0

Author

7
posts
1
comments
4
media
View profile
Nobody had commented when we saved it.

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.