function duel_simulation_test ( )

%*****************************************************************************80
%
%% duel_simulation_test() tests duel_simulation().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 November 2018
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../duel_simulation' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'duel_simulation_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test duel_simulation().\n' );

  p = [ 0.25, 0.30 ];
  duel_num = 1000;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Player 1 accuracy: %g\n', p(1) );
  fprintf ( 1, '  Player 2 accuracy: %g\n', p(2) );
  fprintf ( 1, '  Number of duels simulated = %d\n', duel_num );
  [ s, turn_average ] = duel_simulation ( p, duel_num );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Probability player 1 wins: %g\n', s(1) );
  fprintf ( 1, '  Probability player 2 wins: %g\n', s(2) );
  fprintf ( 1, '  Average number of shots fired = %g\n', turn_average );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'duel_simulation_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../duel_simulation' )

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

