Rubik's TANGLE

“To unravel the 4 coloured ropes 25 identical tiles have to be arranged in a square so that the ropes form continuous lines. The task is straightforward. Trying is fun. The more tiles in place the harder it gets — the complete solution is a daunting challenge.”

So says the intro to a puzzle that's been on my parents' shelf probably my whole life. Every few years, usually at Christmas, someone might have a go at solving it – but always to no avail.

Curious to know how “daunting” this challenge really is, I took it upon myself to hammer out some JavaScript in the Chrome console on my mom's old laptop. A couple hours later (progress slowing after lunchtime booze), we had, for the first time since the 80s, a solution to the Tangle.

The code behind this page not only finds a solution, but also counts the number of tile comparisons required to reach this solution: my algorithm averages out at over 40 million checks, but can easily take 3× that many, depending on the order in which we pick up the tiles. If we had persevered at checking one tile per second, and did not rest till a solution was found, it would likely have taken us over a year at least. Daunting, indeed!

Click here to view the source code on GitHub.

A note on browser performance

This web page uses an HTML5 Web Worker to solve the puzzle in a background thread, and tracks its progress in the grid below. Different browsers perform differently, and sometimes the UI thread struggles to keep up with the worker thread. Chrome solves the puzzle so quickly that the UI actually jams up; for a smoother (slower) experience, try Internet Explorer

The solution

Number of tile checks: 0

Testing the algorithm's performance

Click the button below to start ten consecutive runs of the algorithm, shuffling the order of the tiles each time. (We skip showing its progress in the grid above so that all resources can be used to solve the puzzles quicker.)

Start time:

Run # Tile checks

End time: