PJ's Puzzles

A colourful tile problem

About Mosaica

Mosaica is a daily tile-matching puzzle — rotate coloured triangles so every shared edge matches.

How it was made

I forget exactly what inspired me to make this puzzle. This kind of coloured tile puzzle has existed for a long time, but I decided to make my own.

Essentially, I started by making a virtual tile grid and a toolkit of functions to work with it: to generate random tile layouts of various sizes, to search for valid ways of arranging a set of tiles, to check for duplicates, and so on.

I first used this to create a 5x5 grid of tiles that had only one way to be arranged with correct edge-colour matching. I intended to 3D-print a set of tiles into a physical puzzle as a gift, but then I thought:

There is only one way to arrange those 25 tiles into a valid grid, but could you take 20 of the 25 and make a valid 4x5 grid? Or take 9 tiles and make a 3x3? Maybe there are multiple 3x3 grids possible with certain subsets?

How many possible sub-puzzles are there in this one set of tiles?

So I wrote some more code. The next version would generate a 5x5 grid with one valid solution, then make every possible grid with fewer tiles (down to a 2x2) and try filling it with the tiles from the 5x5.

Then I thought, "How about 6x6? What could go wrong?" Turns out that the number of sub-puzzles was usually triple digits, and generation time started getting unmanageable with the sheer number of combinations... so I dropped back to 5x6. It is surprising how much difference there is between 30 and 36 tiles.

Thirty tiles has the potential for a large number of sub-puzzles, but can be generated in under a minute. Also, the larger the grid, the harder it is, and I found that a 5x6 is already nearly impossible for the average person to solve.

So I 3D-printed a 30-tile puzzle for my dad, with a decent number of sub-puzzles, and gave it to him for Christmas.

A couple of years passed until I started building this site. I had finished porting the two puzzle games that I had already made JavaScript UIs for, and I was looking for the next project.

Then I remembered my tile puzzle maker and realised it could make a decent daily puzzle. Instead of hand-coding a new UI from scratch, I had been experimenting with Cursor AI and thought I would use that to create it from the ground up.

So I spent a couple of days explaining the output of the generator and how the puzzle works, including how I wanted it to function... and the robot made me the Mosaica UI.

Then I came up with the idea for the weekly game: making a 5x6 grid and giving the player a list of sub-puzzles to find.

It seems to be working OK, and I really like how it looks, even if it is a little too hard at times.