A Distance Procedure
To compute the mean square distance between to blocks, define the function
procedure dist(b1, b2 : block) : float;
return ((b1[1,1] - b2[1,1])^2
(b1[1,2] - b2[1,2])^2
(b1[2,1] - b2[2,1])^2
(b1[2,2] - b2[2,2])^2)/4.0;
The dist() function will be applied so the first argument argument is from the code book and the second is from the image