function polyomino_periodic_variants_test ( )

%*****************************************************************************80
%
%% polyomino_periodic_variants_test() tests polyomino_periodic_variants().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 December 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_periodic_variants_test():\n' );
  fprintf ( 1, '  polyomino_periodic_variants() generates variants of\n' );
  fprintf ( 1, '  polyominoes that can periodicly tile a region R.\n' );
%
%  Set the region.
%
  r = [ ...
    1, 1, 1; ...
    1, 1, 1; ...
    1, 1, 1];

  [ r_m, r_n ] = size ( r );

  label = '  Region ito be tiled:';
  polyominoes_print ( r_m, r_n, 1, r, label );
%
%  Set the polyominoes.
%
  p = [ ...
    0, 0, 1; ...
    1, 1, 1;
    0, 0, 0 ];
  [ p_m, p_n ] = size ( p );
  p_num = 1;

  label = '  Array of polyominoes to be analyzed:';
  polyominoes_print ( p_m, p_n, p_num, p, label );
%
%  D is of almost no interest.
%
  d = ( 5 );
%
%  Request variants.
%
  [ v_num, v, v_p ] = polyomino_periodic_variants ( r_m, r_n, r, p_num, p, d );
%
%  Report.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  The polyominoes have %d distinct variants\n', v_num );

  for k = 1 : v_num
    label = sprintf ( '  Variant %d of polyomino %d', k, v_p(k) );
    [ pc_m, pc_n, pc ] = polyomino_condense ( p_m, p_n, v(1:p_m,1:p_n,k) );
    polyomino_print ( v(1:pc_m,1:pc_n,k), label );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_periodic_variants_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

