Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Penrose Pipes (penrosepipes.vercel.app)
17 points by fourthark on Oct 11, 2023 | hide | past | favorite | 12 comments
I’ve been a big fan of Hexapipes since it came out last year. I also wanted to learn about Penrose tiling. So I implemented a Penrose grid for Hexapipes!

My intention is to contribute the code back to Hexapipes. Earlier this year I contributed the Cube grid as a practice run. It is a joy working with the brilliant @gereleth.

It will take some work to raise the code to the Hexapipes standard. But the game is ready to play, so I thought I’d release it at its own domain.

It is based on a new JS library for generating a random area of Penrose tiles, implementing algorithms by Simon Tatham. Demo here:

https://gordonwoodhull.github.io/penrose-fill-polygon/penros...

Please post feedback here or on GitHub:

https://github.com/gordonwoodhull/hexapipes/issues

It’s a relatively easy game as Hexapipes grids go, but it has a fun loopy aesthetic. I hope others enjoy playing it as much as I enjoyed coding it!



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


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.


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


This is addicting. You've got a winner here. Are you going to package it into an app?


Thanks!

Maybe. I think the priority is to improve the CSS so that it plays better on mobile - it should not scroll or zoom at the page level.

Then maybe PWA it? Everything is client side already.

Some discussion is here:

https://github.com/gereleth/hexapipes/issues/44


I played the 5x5 and 7x7 versions on mobile (iOS Safari) and it worked pretty well; I don't remember having any issues with zooming. I switched to desktop for 20x20. I actually did have an issue with Firefox, where I could only zoom the whole page. I switched to Chrome and then I was able to zoom just the tiles.


Hmm, I haven’t seen that Firefox issue, thanks!

If you play a larger grid on mobile, I guarantee you will see the page zooming and scrolling when you only want the puzzle to.


For the Firefox thing, note that I'm on Mac, so I don't actually have a scroll wheel. I tried to use the trackpad but it didn't work. (Chrome was fine)


I'm a big fan of this game. Great job!

I was able to do a consistent 20 seconds per puzzle, I don't know if thats good.


Thanks!

It gets harder on larger boards, because the border pieces are a big hint. (But it’s still pretty easy.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: