function dueling_idiots_test ( )

%*****************************************************************************80
%
%% dueling_idiots_test() tests dueling_idiots().
%
%  Modified:
%
%    07 May 2019
%
%  Author:
%
%    Paul Nahin,
%    some modifications by John Burkardt.
%
%  Reference:
%
%    Paul Nahin,
%    Dueling Idiots and Other Probability Puzzlers,
%    Princeton, 2012,
%    ISBN: 978-0691155005.
% 
  addpath ( '../dueling_idiots' );

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

  ash ( 100 );

  for n = [ 10, 100, 1000, 10000, 100000 ]
    balls ( n );
  end

  baseball ( );

  trial_num = 1000;
  for N = [ 3, 4, 5, 6 ]
    for Q = [ 0.0, 0.3, 0.9 ]
      biased ( trial_num, N, Q );
    end
  end

  fprintf ( 1, '\n' );
  top = 6;
  for bottom = 0 : 3
    fprintf ( 1, 'BINOMIAL: 6-Choose-0 = %d\n', binomial ( top, bottom ) );
  end

  step_num = 200;
  brownian ( step_num );

  for switch_num = [ 5, 10 ]
    bulb ( switch_num );
  end

  trial_num = 10000;
  casino ( trial_num );

  cc ( );

  chess ( 6, 0.1 );
  chess ( 6, 0.0 );

  correlation ( 5 );

  cpm ( );

  for n = [ 1000, 10000 ]
    esim ( n );
  end

  trial_num = 100000;
  flycircle ( trial_num );

  trial_num = 100000;
  flysquare ( trial_num );

  trial_num = 600;
  gas ( trial_num );

  trial_num = 100000;
  generator ( trial_num );

  trial_num = 10000;
  idiots1 ( trial_num );

  idiots2 ( );

  trial_num = 10000;
  p = 0.40;
  kids ( trial_num, p );

  trial_num = 800;
  markov ( trial_num );

  match ( 10, 2 );
  match ( 10, 3 );
  match ( 10, 4 );
  match ( 50, 2 );

  trial_num = 10000;
  monty ( trial_num );

  needle ( );

  trial_num = 100000;
  normal ( trial_num );

  trial_num = 1000;
  for player_num = 2 : 4
    odd ( trial_num, player_num );
  end

  trial_num = 10000;
  onedwalk ( trial_num );

  onewaytodoit ( );

  trial_num = 5000;
  onion ( trial_num );

  paradox ( 100 );

  trial_num = 100000;
  paths ( trial_num );

  trial_num = 50;
  pert ( 50 );

  trial_num = 10000;
  pisim ( trial_num );

  radar ( 100, 0.1, 0.1, 0.15 );

  trial_num = 100000;
  randomsum ( trial_num );

  trial_num = 10000;
  spider ( trial_num );

  stirling1 ( );

  stirling2 ( );

  stirling3 ( );

  theory ( );

  trial_num = 10000;
  thief ( trial_num );

  tub ( 0.2, 13 );
  tub ( 0.2, 40 );
  tub ( 0.05, 40 );

  underdog1 ( );

  underdog2 ( );

  trial_num = 5000;
  for n = [ 2, 6 ]
    xplusy ( trial_num, n );
  end

  xpowery ( );

  trial_num = 20000;
  xyhisto ( trial_num );

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

  rmpath ( '../dueling_idiots' );

  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

