To the left of the vertical red line, count the number of each color on each row.
Then to the right, on each line draw one square of each color to the left every n columns, starting with a square on the first column to the right of the red line, where n is the count of that color.
Start with the color furthest away from the red line, and then color with colors nearer to the red line. If there's overlap, replace the old color with the new one.
Output:
- draw dotted lines
New to topics? Read the docs here!