Its colors seem very regular, but the pattern isn't obvious. This bugged me for about a yearHowever, but I finally figured out the pattern.
Your challenge is to findit becomes visible when we move vertical stripes of the patternrug up and use it to outputdown:
All stripes are colored in the rug's colors using assame way, but each stripe is offset by some height, except for a few bytes as possibleirregularities. Also, the stripes have different widths.
0: lightest blue-ish white
1: lighter blue
2: darker blue
3: darkest blue
4: light green-ish white (the color between the middle orange rows)
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 pixelpixels seems to be a good compromise between precision and compactness. TheThis results in a 42x32 grid, which looks like this when overlayed over the rug:
Correcting for some perspective errors, we now can approximate the colors of this rug like this:
The color scheme shared by all stripes consists, from top to bottom, of these 42 colors: [3, 3, 2, 3, 3, 2, 2, 0, 2, 2, 1, 1, 3, 1, 1, 5, 5, 6, 5, 5, 6, 6, 7, 6, 6, 7, 7, 4, 7, 7, 8, 8, 7, 8, 8, 9, 9, 8, 9, 9, 9, 9]
. (This already contains the information that some rows have different heights, by having multiple entries of the same color in each cella row.)
There are 18 stripes with widthes [2, 3, 3, 3, 1, 1, 4, 2, 1, 6, 1, 1, 2, 2, 2, 3, 2, 3]
.
Their vertical offsets are [3, 4, 3, 4, 2, 0, 2, 4, 7, 9, 10, 9, 5, 3, 5, 3, 4, 5]
, which means the first stripe starts at the color at index 3 in the common scheme, the second stripe at index 4 and so on. Starting from the respective start index, the next 32 colors are used; remaining colors (if any) are unused.
There are some irregularities in the ones seen belowrug. I didn't find a better way of expressing them except for listing their X and Y coordinates in the grid together with their colors:
X [8, 9, 10, 19, 19, 12, 0, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 5, 13, 14, 15, 16, 17, 18, 34]
Y [18, 18, 18, 23, 24, 27, 31, 31, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31]
Color [5, 5, 5, 0, 0, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 9]
(TODO why doesn't this align!?)
Output this 42x32 grid of numbers from 0-9, each corresponding to the color of one cell of the rug:
Note that there are irregularities in there. Those are intentional to better reflect the actual rug and increase difficulty a bit.
- The program shouldnshould not take input.
- Formatting doesn't matter.
- This is code-golf, so shortest answer (in bytes) wins.