Lurker News
Hello, HN - I wanted to share this puzzle game I made during my vacation.

I'm rather fond of the pipes puzzle where your goal is to restore a scrambled network of connections by rotating tiles. It's usually played on a grid of squares and this all started when I decided to make a programmatic solver for that kind of puzzle. Then I realized that with some minor changes the solver could generate new puzzle instances. I thought about what kind of puzzle to make and someone suggested a hexagonal grid. Adapting the generator wasn't too hard but then I had to create a way to play this variant. So I did just that =).
I find hexagonal pipes a bit more difficult than the square variant because there's a larger variety of possible tile shapes. For an extra challenge I implemented wrap mode where the board can connect to itself (right to left and top to bottom), so there are no convenient outer walls to start from.
The site is made with Svelte Kit, its code is available on github at <https://github.com/gereleth/hexapipes>.
Hope you enjoy playing =).

Comments (161) 65 threads

Earlier comments
evan_1 reply#
What are the green/red lines that appear when you click the junction between two hexes?

(really fun game btw, I will have to return to this later. I'm looking forward to sharing this with my 8 year old who's fascinated with logic puzzles.)

gereleth#
Those are edge marks, they let you mark some edges as "definitely a wall" or "definitely a connection". It sometimes helps in harder puzzles).
bunsenhoneydew1 reply#
Love it!

I first played the version of this with squares on a Palm Pilot and that was a long time ago. I was even looking for that version for my iPhone the other day but was drowning in other random games (and little network tools) until I gave up.
It shouldn’t take much effort to turn it into a PWA, so then people can use it just like an app. I already saved it to my Home Screen and would certainly play this as a daily puzzle, just like Wordle. Keep up the great work.

OisinMoran1 reply#
This is super fun! Just played a few and my best on the 5×5 was 0:42. Thanks for sharing!

Love your description too—would love to see a more in-depth write up if you get the time! It's so fun when you can flip from solving something to generating it. I'm also a fan of solving games with code and have made an Upwords bot that plays perfectly but realized I could use it to try to find better "hyperparameters" for the game (like how many points certain bonuses are) by getting it to play itself and having some metric of what a better game would be. Though as you can probably tell from the lack of a link I have yet to do that part.

usmannk1 reply#
my first 5x5 try was 0:58. I was actually very surprised when it came together as it felt like i was just randomly fitting pipes to their nearest neighbors.
OisinMoran#
Yes, much like falling asleep, falling in love, or going bankrupt this was quite the "slowly, then all at once" type of affair.
forty2 replies#
Is there always a single possible solution ? (I did a bunch of small ones and always found a solution pretty quickly)
emadehsan1 reply#
if the pipes are cut from a Spanning Tree connecting all the hexagons (like the one you witness once you have solved), then yes, for those give pipe pieces, there should be only one solution.
jjnoakes1 reply#
Is this true? I can almost imagine one puzzle that can create two different spanning trees. Maybe I ought to draw it up to verify.

Spanning trees may be required but not sufficient for a unique solution.

emadehsan#
You are right. It is possible that branches (pipes) cut from one Spanning Tree might be re-arrangeable into a different Spanning Tree.
gereleth#
All puzzles on the site have a unique solution At least my solver thinks so)). Configurations with multiple solutions are possible, but I weeded those out when generating.

Load more comments