u :=.8cm;
wd := 0.5bp;
color bc, wc;
bc = .2white;
wc = white;
sx := -1u;
sy := -1u;


vardef drawSquareInterior(expr dx, dy, color) =
	fill (dx + 0u, dy + 0u)--(dx + 1u, dy + 0u)--(dx + 1u, dy + 1u)--(dx + 0u, dy + 1u)--cycle withcolor color;	
enddef;

vardef drawSquareCanvas(expr dx, dy, penwidth) =	
	draw (dx + 0u, dy + 0u)--(dx + 1u, dy + 0u)--(dx + 1u, dy + 1u)--(dx + 0u, dy + 1u)--cycle withpen pencircle scaled penwidth;
enddef;

vardef drawBoard(expr dx, dy, colA, colB, colC, colD) = 
	drawSquareInterior(dx + 0u, dy + 0u, colC);
	drawSquareCanvas(dx + 0u, dy + 0u, wd);
	drawSquareInterior(dx + 1u, dy + 0u, colA);
    drawSquareCanvas(dx + 1u, dy + 0u, wd);
    drawSquareInterior(dx + 1u, dy + 1u, colB);
	drawSquareCanvas(dx + 1u, dy + 1u, wd);
	drawSquareInterior(dx + 0u, dy + 1u, colD);
	drawSquareCanvas(dx + 0u, dy + 1u, wd);
enddef;

beginfig(1);
	drawBoard(sx, sy, bc, wc, wc, wc);	
endfig;

beginfig(2);	
	drawBoard(sx, sy, wc, bc, wc, wc);	
endfig;

beginfig(3);
	drawBoard(sx, sy, wc, wc, wc, bc);	
endfig;

beginfig(4);
	drawBoard(sx, sy, wc, wc, bc, wc);
endfig;

beginfig(5);
	drawBoard(sx, sy, bc, bc, bc, wc);
endfig;

beginfig(6);
	drawBoard(sx, sy, bc, bc, wc, bc);
endfig;

beginfig(7);
	drawBoard(sx, sy, wc, bc, bc, bc);
endfig;

beginfig(8);
	drawBoard(sx, sy, bc, wc, bc, bc);
endfig;

beginfig(9);
	drawBoard(sx, sy, bc, wc, wc, bc);
endfig;

end.

