Skip to main content
1 of 3

Golf the colors of a rug

Background

The challenge is based on this rug:

Rug.jpg

Its colors seem very regular, but the pattern isn't obvious. This bugged me for about a year, but I finally figured out the pattern. Your challenge is to find the pattern and use it to output the rug's colors using as few bytes as possible.

First, we need to list all colors:

0: lightest blue
1: lighter blue
2: darker blue
3: darkest blue
4: light green
5: middle green
6: dark green
7: orange
8: light red
9: dark red

Now, we can lay a grid of cells of equal color over this image. I found that using a cell size of 73.5x129 pixel seems to be a good compromise between precision and compactness. The grid looks like this:

enter image description here

Correcting for some perspective errors, the colors in each cell are the ones seen below.

Challenge

Output this 42x32 grid of numbers from 0-9:

333333333332322223302222221222332233333222
332223332223333332221111111122332233322222
222222222223233332221111113100220022222000
220002220002322220013333331322222222200222
002220002222322222211111111122002200022222
222222222220200002231111115111221122222111
221112221112222221115555555511221122211111
111111111112022221115555556533113311111333
113331113331211113356666665611111111133111
331113331111211111155555555511331133311111
111111111113133331165555556555115511111555
115551115551111115556666666655115511155555
555555555551311115556666667666556655555666
556665556665155556667777776755555555566555
665556665555155555566666666655665566655555
555555555556566665576666667666556655555666
556665556665555556667777777766556655566666
666666666665655556667777774777667766666777
667776665556566667774444447466666666677666
776667776666566666677777777766776677766666
666666666667677776647777778777667766666777
667776667776666667778888888877667766677777
777777777776766667778888887844774477777444
774447774447677774407777778777777777744777
447774447777677777708888888877447744477777
777777777774744447778888889888778877777888
778887778887777778889999999988778877788888
888888888887877778889999998977887788888777
887778887778788887798888889888888888877888
779997778888788888899999999988778877788888
889998888887877778889999999999889988888999
998889889998899998899999999999889998899999

Note that there are irregularities in there. Those are intentional to better reflect the actual rug and increase difficulty a bit.

Rules

  • The program shouldn not take input.
  • Formatting doesn't matter.
  • This is , so shortest answer (in bytes) wins.