function boundary_word_plot ( s )

%*****************************************************************************80
%
%% boundary_word_plot() plots a polyomino defined by a boundary word.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    char s(*): a string of the characters 'u', 'd', 'l' and 'r' that should
%    represent a path around the boundary of a polyomino.
%
  check = boundary_word_check ( s );
  if ( ~ check )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'boundary_word_plot - Fatal error!\n' );
    fprintf ( 1, '  Input boundary word "%s" is illegal.\n', s );
    return
  end

  [ xpoly, ypoly ] = boundary_word_boundary ( s );

  [ xmin, xmax, ymin, ymax ] = boundary_word_range ( s );

  clf ( );
  hold ( 'on' );

  for x = xmin : xmax - 1
    for y = ymin : ymax - 1
      interior = polygon_contains_point ( xpoly, ypoly, x+0.5, y+0.5 );
      if ( interior )
        if ( mod ( x + y, 2 ) == 0 )
          fill ( [ x, x+1, x+1, x ], [ y, y, y+1, y+1 ], [ 1.0, 0.0, 0.0 ] );
        else
          fill ( [ x, x+1, x+1, x ], [ y, y, y+1, y+1 ], [ 0.5, 0.5, 0.5 ] );
        end
      end
    end
  end
%
%  Mark the origin.
%
  plot ( 0.0, 0.0, 'k.', 'markersize', 40 );

  title ( s, 'Fontsize', 16 );
  hold ( 'off' );
  axis ( 'equal' );
  axis ( 'off' );

  return
end

