function strategy1_test ( )

%*****************************************************************************80
%
%% strategy1_test() tests locker strategy #1.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 November 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'strategy1_test():\n' );
  fprintf ( 1, '  Each player simply opens lockers at random.\n' );
  fprintf ( 1, '  They may even open some lockers several times.\n' );

  locker_num = 100;
  player_num = 100;
  try_max = 50;

  trial_num = 1000;
  found = zeros ( trial_num, 1 );
  found_all = 0;

  for test = 1 : trial_num
    locker_value = randperm ( locker_num );
    found(test) = strategy1 ( locker_num, locker_value, player_num, try_max );
    if ( found(test) == player_num )
      found_all = found_all + 1;
    end
  end

  found = found / player_num;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of lockers was %d\n', locker_num );
  fprintf ( 1, '  Number of players was %d\n', player_num );
  fprintf ( 1, '  Number of lockers a player can check %d\n', try_max );
  fprintf ( 1, '  Number of trials was %d\n', trial_num );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Success rate = number of players who found wallet / number of players.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Minimum  = %g\n', min ( found ) );
  fprintf ( 1, '  Maximum  = %g\n', max ( found ) );
  fprintf ( 1, '  Mean     = %g\n', mean ( found ) );
  fprintf ( 1, '  Variance = %g\n', var ( found ) );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  All players found their wallets %d times out of %d\n', found_all, trial_num );

  return
end

