MODULAR

var xx = x%2; // is x a multiple of 2?
var yy = y%2; // is y a multiple of 2?


if ( xx == yy ) { c = "pink"; } else { c = "blue"; }



Use fillRect() instead of fill()