HNHacker News
TopNewBestAskShowJobs

gereleth

338 karma · joined July 24, 2022

submissionscomments
gereleth··on Show HN: Penrose Pipes
This is a good start! Exactly like hexapipes began lol. I just wanted to make a solver to overcome my addiction to this puzzle.

Come open a discussion on github if you have further questions or just want to share your progress =) https://github.com/gereleth/hexapipes/discussions

gereleth··on Show HN: Penrose Pipes
I think the downloaded version of Penrose puzzles does not currently contain enough info to run a solver on it. Because the grid is different every time and this info is not present in the downloaded file.

But I can tell you how it works for other grids =).

The contents of `tiles` key are an array of tile shapes. Possible directions where there are connections are binary-encoded. For example, on a square grid 1 means right, 2 means up, 4 means left and 8 means down. So a 3 means a corner piece connecting up and right, a 5 is a horizontal straight piece. A 0 means an empty tile, 15 in this case is a fully connected + tile. It's similar for other grids.

How the tiles are numbered depends on grid implementation. In a square 5x5 puzzle the indices would go like this:

0 1 2 3 4

5 6 7 8 9

...

You can look at grid implementations here: https://github.com/gereleth/hexapipes/tree/main/src/lib/puzz...

You can also import a downloaded puzzle (non-penrose) on the custom puzzle page and watch my solver work on it)). https://hexapipes.vercel.app/custom

gereleth··on Show HN: Penrose Pipes
Hexapipes author here =). This is awesome! People kept mentioning Penrose grid to me but I didn't know where to even start with it. And then you went and made it happen! I admire the dedication it took, love collaborating with you!

The bumpy history of this grid's development can be found in this issue: https://github.com/gereleth/hexapipes/issues/83

First hexapipes thread for context: https://news.ycombinator.com/item?id=32216436

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Haha, way to go, this is awesome. Did it solve it all without human input? Can it do wraps?

Sorry about your sleep schedule).

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
I see, thanks for reporting.

This contextmenu issue is sure showing me the ugly side of frontend development :/

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Congrats! This is some amazing dedication =).
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Sorry about this. I sometimes place them accidentally too.

I have an idea of placing them with some kind of gesture - like touch and drag between tiles. That wouldn't interfere with tapping to rotate tiles. But on the other hand, I'm usually zoomed in on mobile and I use touch and drag to move around. Interfering with that would be bad too.

I'm open to ideas for better controls.

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Thanks for the feedback. I'm very sure all puzzles on the site are solvable. But a skip button makes total sense when one hits a deadend. I'll work it in when I have the time.

With a randomize button do you mean a complete reset to initial state? Or something like keep the locked tiles, reset the rest?

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Browser zoom kinda works. But yeah, adding better zoom/pan is in my backlog.

You sure are brave to take on a 40x40 =)

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
They all need to be connected into a single network. No hanging connections, no loops, no disjoint parts.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Thanks for reporting, I'll look into this.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Are you on a Mac? I thought I got rid of this but I haven't tested on those.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
On the backlog it goes). Can't promise I'll get to it in a timely manner but thanks for the suggestion.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Oops, thanks for reporting. I'll try to find someone with a Mac to debug this.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
I didn't use any special coordinates, just some trigonometry. My code transforms coordinates between (x,y) - for drawing, (row, column) - for finding neighbours and (index into an array of tiles) - for managing state. It sort of grew organically and could probably be cleaned up a lot.

The hardest part was making the board repeat for the wrap variant making sure that all tiles have consistent wrap neighbours. I almost deployed a version that worked fine on odd-sized grids and went completely bananas on even-sized grids. The danger of always testing on a 5x5 board)).

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
This loopover thing is hard... I unscrambled two lines and was quickly running out of movement freedom. =)

You can try the wrap variant for an extra challenge.

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Fun puzzle! I played a few levels and I can see some similarities. Did you handcraft the levels? They don't look algorithmically generated.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
I remember being pretty mad at how a straight piece isn't immediately solved after you fix one wall. Like how can it still have wiggle room?! =))

All general principles still apply though, so experience with Net certainly helps here.

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Wow, did you really start with a 40x40? I only solved like two of them ever. It's pretty time consuming).

And good time on the wrap! Small wrap boards can actually be harder than larger ones because there's less chance of finding some seed tiles to start from.

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Thanks for the feedback. I already promised to add timer hiding option in another comment thread, will do on the weekend.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
You can change control mode in the settings. The default is rotate/lock, but there's a rotate/rotate as well. And... another tricky one for orienting a tile in one click.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Mm, middle button, why didn't I think of it.

My wrap puzzles show an infinite tiled grid, so there shouldn't be questions about which edge wraps where. There are no edges, tiles just start repeating after a while. Maybe I didn't understand your question about wrapping?

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
The file to look at would be this Tile component: https://github.com/gereleth/hexapipes/blob/main/src/lib/puzz...

My svg handling was very much "learn as I go". An earlier version even had circles instead of hexagons because they're simpler to do. There's a cool playthrough video of that version: https://www.youtube.com/watch?v=vlpPr485NUY

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Good idea! I'm already thinking of how to implement... I really need another vacation or two, lol
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Fair enough, I'll think how to word all this.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
There aren't really any assets though. I just create the svgs dynamically. Maybe I need to place some strategic `Math.round` calls here and there, never thought of this =).
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
There might still be issues with multiple solutions... Because when a board has multiple solutions they're all valid Spanning Trees. But there probably is some way around this.

An efficient generator could perhaps even work client side, so I wouldn't have to store premade puzzle instances in the repo. That would be cool =).

gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
Thanks for sharing, I'll add that option (on the weekend most likely).
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
You can check out "Orient / Lock" control mode in the settings. It lets you orient a tile in one tap but needs precision about where you tap. I mostly use this mode but it takes some getting used to, so I didn't make it the default.
gereleth··on Show HN: Pipes puzzle (a.k.a. Net) on a hexagonal grid
This is pretty much how I solve regular puzzles too. I can do most 5x5s in under 20 seconds. Too often did my debugging sessions devolve into puzzle marathons =).

Wrap variants are another story as they have no outer edges. Discovering which tile groups give initial clues there is pretty fun too (when the regular puzzles aren't much of a challenge any more).

Page 1 of 2Next →