This is my golf-ed solution for generating a munching square (https://en.wikipedia.org/wiki/Munching_square). Even abused PPM image format (https://en.wikipedia.org/wiki/Netpbm_format#PPM_example) parsers tolerance. This example requires imagemagick for display:
gawk 'BEGIN{s=256;print("P3\n"s,s"\n"s-1);for(;x<s;x++)for(y=0;y<s;y++){b=xor(x,y);print(0,b,b)}}' | display
And this is what you get:
AWK code golf Show more
@kevinja Really i don't like writing code like this - but you learn things trying to squeeze the character count.
I uploaded an easier to read, commented and ungolfed version: https://gist.github.com/julianaito/2204be6521def0c5196c9aa46187295e