Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple five lines solution in Clear category for [old] Matrix Pattern by MaxGraey
function matrix(pattern, image, h = image.length-pattern.length+1, w = image[0].length-pattern[0].length+1) {
for (let y = 0; y < h; y++)
for (let x = 0; x < w; x++)
if (pattern.every((r,dy) => r.every((e,dx) => (e & 1) == image[y + dy][x + dx])))
pattern.forEach((r,dy) => r.forEach((_,dx) => { image[y + dy][x + dx] = (image[y + dy][x + dx] & 1) + 2 }))
return image
}
May 30, 2019