function cellular_automaton_test ( )

%*****************************************************************************80
%
%% cellular_automaton_test() tests cellular_automaton().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 December 2018
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../cellular_automaton' )

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

  cell_num = 75;
  step_num = floor ( ( cell_num - 3 ) / 2 ) ;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Print and plot the evolution of the rule #30 cellular automaton\n' );
  fprintf ( 1, '  starting with an array of %d horizontal cells,\n', cell_num )
  fprintf ( 1, '  with a single nonzero cell in the middle.\n' );
  fprintf ( 1, '  Apply rule #30 for %d steps forward in time.\n', step_num );
  fprintf ( 1, '\n' );

  x = cellular_automaton ( cell_num, step_num );

  cellular_automaton_print ( cell_num, step_num, x );

  cellular_automaton_plot ( cell_num, step_num, x );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'cellular_automaton_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../cellular_automaton' )

  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

