function truel_simulation_test ( )

%*****************************************************************************80
%
%% truel_simulation_test() tests truel_simulation().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 April 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../truel_simulation' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'truel_simulation_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test truel_simulation().\n' );
%
%  Strategy 1
%
  for strategy = 1 : 4

    p = [ 2/6, 4/6, 5/6 ];
    truel_num = 1000;
    [ s, turn_average ] = truel_simulation ( p, strategy, truel_num );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Truel statistics estimated from %d simulations\n', truel_num );
    fprintf ( 1, '  Strategy = %d\n', strategy );
    fprintf ( 1, '  Average number of shots = %d\n', turn_average );
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Player  Accuracy  Survival\n' );
    fprintf ( 1, '\n' );
    for i = 1 : 3
      fprintf ( 1, '  %d  %8.2f  %8.2f\n', i, p(i), s(i) );
    end

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'truel_simulation_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../truel_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

