No BSD License  

Highlights from
Magic 8 Ball

from Magic 8 Ball by Scott Copeland
70's novelty

magic8ball(n)
function magic8ball(n)
% Based on "why"
% Uses the official magic 8-ball answers according to http://ofb.net/8ball/answers.html
% GSC 3/4/2002
%
%WHY    Provides succinct answers to almost any question.
%   WHY, by itself, provides a random answer.
%   WHY(N) provides the N-th answer.
%   Please embellish or modify this function to suit your own tastes.

%   Copyright 1984-2001 The MathWorks, Inc. 
%   $Revision: 5.14 $  $Date: 2001/04/15 12:02:27 $

if nargin > 0, rand('state',n); end
a = special_case;
a(1) = upper(a(1));
disp(a);


%------------------

function a = special_case
switch fix(20*rand)
    case 0,   a = 'Signs point to yes';
    case 1,   a = 'Yes';
    case 2,   a = 'Reply hazy, try again';
    case 3,   a = 'Without a doubt.';
    case 4,   a = 'My sources say no. ';
    case 5,   a = 'As I see it, yes. ';
    case 6,   a = 'You may rely on it. ';
    case 7,   a = 'Concentrate and ask again.';
    case 8,   a = 'Outlook not so good. ';
    case 9,   a = 'It is decidedly so. ';
    case 10,  a = 'Better not tell you now. ';
    case 11,   a = 'Very doubtful.';
    case 12,   a = 'Yes - definitely.';
    case 13,   a = 'It is certain.';
    case 14,   a = 'Cannot predict now. ';
    case 15,   a = 'Most likely. ';
    case 16,   a = 'Ask again later.';
    case 17,   a = 'My reply is no. ';
    case 18,   a = 'Outlook good. ';
    case 19,   a = 'Don''t count on it.';
    otherwise,a = 'Very doubtful. ';
end

Contact us at files@mathworks.com