function variety = variomino_variety ( p, vmax )

%*****************************************************************************80
%
%% variomino_variety() returns the variety of a variomino.
%
%  Discussion:
%
%    A polyomino is a shape formed by connecting unit squares edgewise
%
%    A variomino is a polyomino in which each square has been assigned
%    a value between 1 and vmax.
%
%    A variomino can be represented by an MxN matrix, whose entries are
%    between 1 and vmax for squares that are part of the variomino, 
%    and 0 otherwise.
%
%    The "variety" of a variomino is a vector of length vmax which
%    counts the number of squares with each value between 1 and vmax.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 April 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer p(mp,np): the matrix representing the variomino.
%
%  Output:
%
%    integer variety(vmax): the variety of the variomino.
%
  variety = zeros ( vmax, 1 );
  for i = 1 : vmax
    variety(i) = sum ( sum ( p == i ) );
  end

  return
end
