function bingo_test ( )

%*****************************************************************************80
%
%% bingo_test() tests bingo().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 January 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'bingo_test():\n' );
  fprintf ( 1, '  bingo(A,B) simulates a simplified game of bingo.\n' );
  fprintf ( 1, '  The bingo card is no just a 2x2 array.\n' );
  fprintf ( 1, '  Player X gets card A, and player Y gets card B.\n' );
  fprintf ( 1, '  Many random games are played, and the results are reported.\n' );
  fprintf ( 1, '  There are four possible bingo cards, C1, C2, C3, C4.\n' );
  fprintf ( 1, '  It turns out to be a nontransitive system, in which every\n' );
  fprintf ( 1, '  card will beat one of the others, and lose to another.\n' );

  A = [ 1, 2; 3, 4 ];
  B = [ 2, 4; 5, 6 ];
  C = [ 1, 3; 4, 5 ];
  D = [ 1, 5; 2, 6 ];

  card = A;
  card(:,:,2) = B;
  card(:,:,3) = C;
  card(:,:,4) = D;

  name = 'ABCD';

  disp ( '  The four bingo cards' );
  card

  for k1 = 1 : 4
    for k2 = 1 : 4
      [ xwin, ywin, ties ] = bingo ( card(:,:,k1), card(:,:,k2) );
      fprintf ( 1, '  %s  %s  %d, %d, %d\n', ...
        name(k1), name(k2), xwin, ywin, ties );
    end
  end

  return
end

