function digital_dice_test ( )

%*****************************************************************************80
%
%% digital_dice_test() tests digital_dice().
%
%  Discussion:
%
%    The slow execution of Octave mandates reducing the occasional
%    trial_num values of 1,000,000 to 100,000.
% 
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 January 2023
%
%  Reference:
%
%    Paul Nahin,
%    Digital Dice: Computational Solutions to Practical Probability Problems,
%    Princeton, 2008,
%    ISBN: 978-0-691-15821-1.
% 
  addpath ( '../digital_dice' );

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

  trial_num = 10000;

  aandb ( trial_num );
  
  average ( trial_num );

  baby_boom ( trial_num );

  broke ( trial_num, 1, 1, 1, 0.5 );
  broke ( trial_num, 1, 2, 3, 0.5 );
  broke ( trial_num, 2, 3, 4, 0.5 );
  broke ( trial_num, 3, 3, 3, 0.5 );
  broke ( trial_num, 4, 7, 9, 0.5 );
  broke ( trial_num, 1, 1, 1, 0.4 );
  broke ( trial_num, 1, 2, 3, 0.4 );
  broke ( trial_num, 2, 3, 4, 0.4 );
  broke ( trial_num, 3, 3, 3, 0.4 );
  broke ( trial_num, 4, 7, 9, 0.4 );

  for n = 1 : 5
    bus ( trial_num, n );
  end

  for n = [ 3, 10, 20, 30 ]
    car ( trial_num, n );
  end

  chess ( trial_num, 0.9, 0.8 );
  chess ( trial_num, 0.9, 0.4 );
  chess ( trial_num, 0.4, 0.3 );
  chess ( trial_num, 0.4, 0.1 );

  committee ( trial_num );

  deli ( 30, 40, 1 );
  deli ( 30, 40, 2 );
  deli ( 50, 25, 1 );
  deli ( 50, 25, 2 );

  dinner ( );

  dish ( trial_num );

  easywalk ( 1000 );

  election ( trial_num, 3, 2, 2, 0 );
  election ( trial_num, 3, 3, 2, 1 );
  election ( trial_num, 7, 7, 4, 0 );
  election ( trial_num, 25, 2, 17, 1 );

  estimate ( trial_num );

  floss ( 40 );
  floss ( 150 );

  forgetful_burglar ( trial_num );

  gameb ( trial_num );

  for n = 1 : 3
    gs ( trial_num, n );
  end

  m = 24;
  guess ( trial_num, m );

  jury ( trial_num );

  p = 0.4;
  kelvin ( trial_num, p );

  malt ( trial_num );

  a = 49;
  for m = 3 : 5
    missing ( trial_num, a, m );
  end

  mono ( trial_num );

  obtuse ( trial_num );

  obtuse1 ( trial_num );

  optimal ( trial_num, 11, 2 );
  optimal ( trial_num, 50, 5 );

  for n = 1 : 5
    patrol ( trial_num, n );
  end

  pierror ( trial_num );

  ranking ( trial_num, 24 );

  rhs ( trial_num );

  rolls ( );

  smoker ( trial_num );

  smokerb ( trial_num );

  spin ( trial_num );

  for k = [ 0, 1, 2, 3, 9 ]
    steve ( trial_num, k );
  end

  for n = [ 5, 10, 20, 50, 100 ]
    stopping ( n );
  end

  sylvester_quadrilateral ( trial_num );

  umbrella ( trial_num, 1, 1 );
  umbrella ( trial_num, 2, 2 );

  for m = [ 2, 5, 10, 20, 50, 100 ]
    walk ( trial_num, m );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'digital_dice_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../digital_dice' );

  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

