function treepack_test14 ( )

%*****************************************************************************80
%
%% treepack_test14 tests tree_rb_yule.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    28 June 2013
%
%  Author:
%
%    John Burkardt
%
  n_max = 11;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TREEPACK_TEST14\n' );
  fprintf ( 1, '  TREE_RB_YULE carries out one step of the Yule model\n' );
  fprintf ( 1, '  on a rooted binary tree stored in preorder traversal form.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Each call adds two children to an arbitary leaf.\n' );

  for i = 1 : 5

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Simulation %d\n', i );
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Nodes  Preorder code\n' );
    fprintf ( 1, '\n' );

    n = 0;
    a = [];

    while ( true )

      [ n, a ] = tree_rb_yule ( n, a );

      fprintf ( 1, '  %2d  ', n );
      for i = 1 : n
        fprintf ( 1, '%d', a(i) );
      end
      fprintf ( 1, '\n' );

      if ( n_max < n + 2 )
        break;
      end

    end

  end

  return
end

