beginfig(1); %the color scheme def r = 0.4*white enddef; def y = 0.7*white enddef; def b = 1*white enddef; def blk = .1*white enddef; u=1.25in; %overall scale s=.5in; %offset between squares k=1pt; %thickness of the black lines %macro to draw the square def colsquare(expr xshift,yshift, cola, colb, colc, cold) = fill (0,0)--(0,u)--(0.5u,0.5u)--(0,0)--cycle % shifted (xshift*(u+s),yshift*(u+s)) withcolor cola; fill (0,u)--(u,u)--(0.5u,0.5u)--(0,u)--cycle % shifted (xshift*(u+s),yshift*(u+s)) withcolor colb; fill (u,u)--(u,0)--(0.5u,0.5u)--(u,u)--cycle % shifted (xshift*(u+s),yshift*(u+s)) withcolor colc; fill (u,0)--(0,0)--(0.5u,0.5u)--(u,0)--cycle shifted % (xshift*(u+s),yshift*(u+s)) withcolor cold; draw (0,0) shifted (xshift*(u+s),yshift*(u+s))--% (0,u) shifted (xshift*(u+s),yshift*(u+s))--% (u,u) shifted (xshift*(u+s),yshift*(u+s))--% (u,0) shifted (xshift*(u+s),yshift*(u+s))--% (0,0) shifted (xshift*(u+s),yshift*(u+s))--cycle % withcolor blk withpen pencircle scaled 2k; draw (0,0) shifted (xshift*(u+s),yshift*(u+s))--% (u,u) shifted (xshift*(u+s),yshift*(u+s)) % withcolor blk withpen pencircle scaled k; draw (0,u) shifted (xshift*(u+s),yshift*(u+s))--% (u,0) shifted (xshift*(u+s),yshift*(u+s)) % withcolor blk withpen pencircle scaled k; enddef; %first row colsquare(0,0,b,y,r,b); colsquare(1,0,r,r,r,b); colsquare(2,0,r,y,y,b); colsquare(3,0,y,b,b,b); %second row colsquare(0,1,b,y,b,y); colsquare(1,1,b,r,b,r); colsquare(2,1,b,r,b,y); colsquare(3,1,b,b,b,b); %third row colsquare(0,2,b,y,y,y); colsquare(1,2,y,y,r,r); colsquare(2,2,r,r,r,r); colsquare(3,2,r,y,b,b); %fourth row colsquare(0,3,b,y,r,y); colsquare(1,3,r,y,y,y); colsquare(2,3,y,r,r,r); colsquare(3,3,r,r,b,y); %fifth row colsquare(0,4,b,b,y,y); colsquare(1,4,y,y,y,y); colsquare(2,4,y,r,y,r); colsquare(3,4,y,r,b,r); %sixth row colsquare(0,5,b,b,r,b); colsquare(1,5,r,b,y,y); colsquare(2,5,y,b,r,r); colsquare(3,5,r,b,b,r); endfig;