MARIO_GRAY = [ ... 
 6, 6, 6, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6; 
 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6; 
 6, 6, 3, 3, 3, 4, 4, 4, 0, 4, 6, 6, 6; 
 6, 3, 4, 3, 4, 4, 4, 4, 0, 4, 4, 4, 6; 
 6, 3, 4, 3, 3, 4, 4, 4, 4, 0, 4, 4, 4; 
 6, 6, 6, 4, 4, 4, 4, 4, 0, 0, 0, 0, 6; 
 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6; 
 6, 6, 2, 2, 1, 2, 2, 2, 2, 6, 6, 6, 6; 
 6, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 6, 6; 
 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 6; 
 4, 4, 2, 1, 5, 1, 1, 5, 1, 2, 4, 4, 6; 
 4, 4, 4, 1, 1, 1, 1, 1, 1, 4, 4, 4, 6; 
 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 6; 
 6, 6, 1, 1, 1, 6, 6, 1, 1, 1, 6, 6, 6; 
 6, 3, 3, 3, 6, 6, 6, 6, 3, 3, 3, 6, 6; 
 3, 3, 3, 3, 6, 6, 6, 6, 3, 3, 3, 3, 6];

[ m, n ] = size ( MARIO_GRAY );

%
% 0: black         0  0.0
% 1: very dark    43  0.17
% 2: dark gray    85  0.33
% 3: half gray   127  0.50
% 4: light gray  170  0.66
% 5: very light  212  0.84
% 6: white       255  1.00
%
clf
hold on

for i = 1 : m
  for j = 1 : n

    k = MARIO_GRAY(i,j);

    g = k / 6;
%
%  This modification makes it easier for the eye to distinguish the gray levels.
%
%   g = sqrt ( g );

    color = [ g, g, g ];

    a = j - 1;
    b = j;
    c = m - i + 1;
    d = m - i;
    fill ( [ a, b, b, a ], [ c, c, d, d ], color );

  end
end
axis equal
axis off
hold off

print ( '-djpeg', 'mario_gray_matlab.jpg' );
