Hacker News new | ask | show | jobs
by manifoldgeo 974 days ago
This is amazing! After playing my first game, I feel immediately inspired to think about the relationships among the tiles / positions. Maybe I'll try to write some kind of solver as a learning exercise.

I noticed that there is an option to download the puzzle as JSON, and I tried it. Can you tell us what the schema is? I see there's a key called `tiles` that has a value of an object mapping ints to other ints. What do those ints represent? I figure since there are 36 tiles, they key int is the tile number, but what about the value? I think this info would be valuable for programmatically solving these puzzles.

Once again, great work! I have a feeling this will be a big hit, possibly of Wordle-like proportions.

1 comments

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

This is so cool to receive a response from the creator of Hexapipes! Thank you for the reply!

That makes sense re: the Penrose grid being different and not having enough data in the numbers to make sense of yet.

Based on your help, I've decided to start with the square grid, and I've gotten as far as a simple program that can take the JSON and render a puzzle as a png image. Now to draw the rest of the owl...

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