function galileo ( )

%*****************************************************************************80
%
%% GALILEO computes the frequency of various sums of three dice.
%
%  Discussion:
%
%    If three dice are thrown, the sum will be between 3 and 18.
%    How many ways are there to make each sum?
%
%  Modified:
%
%    30 January 2018
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Will You Be Alive 10 Years From Now?,
%    Princeton, 2014,
%    ISBN: 978-0691156804,
%    LC: QA273.25.N344
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'GALILEO:\n' );
  fprintf ( 1, '  If three dice are thrown, the sum will be between 3 and 18.\n' );
  fprintf ( 1, '  How many ways are there to make each sum?\n' );

  total = zeros ( 18, 1 );

  for i = 1 : 6
    for j = 1 : 6
      for k = 1 : 6
        s = i + j + k;
        total(s) = total(s) + 1;
      end
    end
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Total  Frequency\n' );
  fprintf ( 1, '\n' );
  for s = 1 : 18
    fprintf ( 1, '     %2d     %2d\n', s, total(s) );
  end 

  return
end
