function found = strategy1 ( locker_num, locker_value, player_num, try_max )

%*****************************************************************************80
%
%% strategy1() uses strategy #1 on the locker problem.
%
%  Discussion:
%
%    The lockers are checked at random.  In fact, a list is prepared in
%    advance, and may contain duplicates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 November 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer locker_num: the number of lockers.
%
%    integer locker_value(locker_num): the number stored in each locker.
%
%    integer player_num: the number of players.
%
%    integer try_max: the maximum number of tries allowed.
%
%  Output:
%
%    integer found: the number of wallets that were found.
%
  found = 0;

  for player = 1 : player_num

    locker_index = randi ( [ 1, locker_num ], try_max );

    for trial = 1 : try_max
      locker = locker_index(trial);
      if ( locker_value(locker) == player )
        found = found + 1;
        break
      end
    end

  end

  return
end

