% --- start of displayed preamble in the book ---

% --- end of displayed preamble in the book ---
% graphic converted to gray in book using 'color2gray'
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
numeric psi,iter,c,r,t,cv;
path p;
psi=137.6;
iter=200;
c=5;
r=0;
for i=iter downto 1:
  t:=sqrt(i);
  r:=(r+psi) mod 360;
  cv:=cosd((i/iter)*90);
  p:=((0,0)--(t,1)--
      (t+1,0)--(t,-1)--cycle)
     rotated r;
  fill p scaled c withcolor (1,cv,0);
  draw p scaled c;
endfor;
endfig;
end;