If you're sad, that's wrong. We need to scrub out ALL sadness.
This is a sad face, for reference:
......
.S..S.
........
...SS...
..SS..SS..
.S......S.
........
Where S
is a consistent pixel, .
is any pixel other than S
, and
is any pixel. Note that the sad face is not a perfect square, only the .
should be considered. Theoretical sad face overlap in the corners is possible, but overwriting one sad face has a chance to eliminate the other, e.g. if it was in a .
character and is overwritten with an S
.
Input
An image, in any acceptable format. I would recommend a color matrix.
Output
The same image, but take all those treasonous sad faces and replace their S
characters with randomized data. The data should be either random RGB values, or values taken from the palette of the image. You just need to have a nonzero probability of all outputs; you do not need to make it uniform.
Rules
S
can be any pixel, as long as it's the same pixel throughout the formation.- Remove ALL sad faces. If the removal makes a new sad face, then remove that too.
- You should only modify
S
pixels. Unauthorized modification of pixels is insubordination, punishable by disqualification. - The shortest answer in bytes wins.
Test Cases
These have one sad face each:
This has 2 sad faces, on the left and right:
This has 2 sad faces overlapping:
This has 2 sad faces, in the top-left and bottom-right; the bottom-left and top-right have S
characters in the place of .
characters: