Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Incubator Q&A

Welcome to the staging ground for new communities! Each proposal has a description in the "Descriptions" category and a body of questions and answers in "Incubator Q&A". You can ask questions (and get answers, we hope!) right away, and start new proposals.

Are you here to participate in a specific proposal? Click on the proposal tag (with the dark outline) to see only posts about that proposal and not all of the others that are in progress. Tags are at the bottom of each post.

Comments on Two closed loops

Post

Two closed loops Question

+5
−0

Grid

This puzzle is played on a 5 by 5 grid of squares:

An empty grid of 25 squares in 5 rows and 5 columns

Tiles

  • There are 25 tiles to be placed on the grid, one on each square.
  • They can each be rotated by any multiple of 90 degrees.
  • Note that the first tile (the top left) is deliberately blank. This means that one of the squares in the completed grid will be blank.

A grid of 25 squares in 5 rows and 5 columns each showing a tile with 0, 1, or 2 lines in one of 2 different styles

Puzzle

Place all of the tiles on the grid such that the two different styles of line each form a single closed loop.

Example

This shows a solution to a similar puzzle on a 3 by 3 grid.

Hidden example

Given the following tiles:

A grid of 9 squares in 3 rows and 3 columns each showing a tile with 0, 1, or 2 lines in one of 2 different styles

You could arrange them like this:

A grid of 9 squares in 3 rows and 3 columns each showing a tile with 0, 1, or 2 lines in one of 2 different styles

This has all of the segments of each style in a single line, but only one of them is a closed loop. The other line has 2 ends, so this is not a solution to the puzzle.

The tiles can instead be arranged into 2 closed loops:

Solution to the 3 by 3 example puzzle

A grid of 9 squares in 3 rows and 3 columns each showing a tile with 0, 1, or 2 lines in one of 2 different styles

Printing

If you want to print the images to cut out the tiles and experiment with rearranging them, or to photograph your solution to add to your answer, you can click on the images to open them separately.

History

2 comment threads

Automated solver (12 comments)
Impressed with the visual look of the 25 tiles (3 comments)
Automated solver

As a challenge to myself, I am creating a computer program to solve this type of puzzle.

trichoplax‭ wrote 2 months ago

I'd be interested to see how it goes.

I had a go at making a solver for a calendar based puzzle called "A puzzle a day" a few years ago.

My automated solver can easily solve your 3x3 example puzzle but it gets stuck on your main 5x5 puzzle. Would you happen to have a 4x4 puzzle that it can try?

trichoplax‭ wrote 2 months ago

I didn't make any 4 by 4 versions but making one of these is easier than solving it. You can choose tiles to make the ends of your lines join up.

How does your solver do if you add 16 blank tiles to the 3 by 3 puzzle to make a less crowded 5 by 5 puzzle?

Thanks for your suggestion. I tried padding your 3x3 example puzzle with 16 blank tiles and my program was able to solve it on a 5x5 grid.

trichoplax‭ wrote 2 months ago

That's progress. If you want tips on making it more efficient to handle more complex loops on larger grids, there's the option of posting your code to Software Development Codidact's Code Reviews category. They offer advice on code style and readability, but also specifically performance improvements if you request that.

Thanks for that idea. At this stage, I am still trying to improve 2 things: 1) My program 2) My deductions about your 5x5 puzzle.

Skipping 1 deleted comment.

will.octagon.gibson‭ wrote about 2 months ago

My program, which randomly permutes and/or rotates tiles, can now solve your 5x5 puzzle sometimes. I am thinking of asking for a code review as you suggested. May I have your permission to include text and images from your post in my code review request?

trichoplax‭ wrote about 2 months ago

Thanks for asking, but since the puzzle is posted with the default licence of CC BY-SA 4.0, you are already free to reuse it under that licence (which is also the default on Software Development Codidact).

I'd expect a link back to this puzzle question to be sufficient to cover attribution, but if there's any doubt, consider this comment my explicit permission to include any text and images from this post (or the GitHub repository if it's easier to link there directly) in your code review post.

will.octagon.gibson‭ wrote about 2 months ago

Thanks. I had intended to link my code review request back to your post. I don’t think I will link my review post to your GitHub repository because, who knows, maybe in the future your repository will not be available.

Peter Taylor‭ wrote about 1 month ago

My automated solver in Python finds only the solution already given in will's answer, modulo symmetries of the square.

will.octagon.gibson‭ wrote about 1 month ago

Peter Taylor‭ Thanks for posting your code. After finding and posting my solution to trichoplax’s 5x5 puzzle, using intelligent trial and error, I looked at the puzzle again and was able to prove that my solution was unique except for rotation.