% --- start of displayed preamble in the book ---
def square=(unitsquare
    shifted (-.5,-.5) scaled 3mm)
enddef;
def circle=(fullcircle scaled 3mm) enddef;
% --- end of displayed preamble in the book ---
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
for i=0 upto 4:
  for j=0 upto 4:
    if odd(i+j):
      draw square shifted (i*6mm,j*6mm);
    else:fill circle shifted (i*6mm,j*6mm);
    fi
  endfor;
endfor;
endfig;
end;