%begin
%include "mach:extl1.imp"

%integer %fn random (%integer mask)
%own %integer seed = 17
   seed = (seed {* 17 // 42 + 101}+3259) %until seed&mask # 0
   %result = seed & mask
%end

%const %integer cx = 343, cy = 255
%integer old x = 0, old y = 0
%routine move (%integer x, y)
   old x = x
   old y = y
%end

%routine draw (%integer x, y)
   line(old x+cx, old y+cy, x+cx, y+cy)
   old x = x
   old y = y
%end

%integer d, i, j1, j2, k

clear
d = 2

j1 = 0
%for k = 252, -16, 12 %cycle
   j2 = random (7) %until j2 # j1
   j1 = j2
   colour(j1)
   %for i = -k, d, k %cycle
      move (k, i)
      draw (-k, -i)
      move (i, -k)
      draw (-i, k)
   %repeat
%repeat

%end %of %program
