function liar_test ( )

%*****************************************************************************80
%
%% liar_test() tests liar().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 January 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'liar_test():\n' );
  fprintf ( 1, '  liar() estimates the probability PROB that a true statement,\n' );
  fprintf ( 1, '  passed sequentially along a chain of N people,\n' );
  fprintf ( 1, '  will reach the end of the chain as a true statement,\n' );
  fprintf ( 1, '  given that, with probability P, each person repeats\n' );
  fprintf ( 1, '  the statement they just hear, or with probability 1-P,\n' );
  fprintf ( 1, '  repeats the opposite of the statement.\n' );

  n_test = [ 1, 2, 3, 41, 42, 1, 2, 3, 41, 42 ];
  p_test = [ 0.99, 0.99, 0.99, 0.99, 0.99, 0.01, 0.01, 0.01, 0.01, 0.01 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  N  P  PROB\n' );
  fprintf ( 1, '\n' );
  for i = 1 : 10
    n = n_test(i);
    p = p_test(i);
    prob = liar ( n, p );
    fprintf ( 1, '  %d  %g  %g\n', n, p, prob );
  end

  return
end

