[comp.sources.games] v01i067: psychic - a fortune teller

games-request@tekred.TEK.COM (06/30/87)

Submitted by: Bruce Holloway <drivax!holloway@ames.arpa>
Comp.sources.games: Volume 1, Issue 67
Archive-name: psychic

	[No warrantys expressed or implied on your fortune.   -br]

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  psychic.c
# Wrapped by billr@tekred on Mon Jun 29 16:39:25 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f psychic.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"psychic.c\"
else
echo shar: Extracting \"psychic.c\" \(9493 characters\)
sed "s/^X//" >psychic.c <<'END_OF_psychic.c'
X/*****************************************************************************
X*	PSYCHIC.C						   Version 1.0
X*
X*	This program is attuned to the Powers of the Ancients, and the
X*	Mysterious Forces which Shape our Destiny. With This Program, You
X*	will Be Privy to the same Sources of Knowledge and Mystic Oracles
X*	used by Ancient Astronauts.
X*
X*	Know that this Font of Wisdom will work on BSD Unix Systems Unmodified,
X*	but the Ancients have Decreed that you must change "#undef SYSV" to
X*	"#define SYSV" in the Line Below if you have the System of Fives.
X*
X*	When		Who	Why
X*	==============	=======	==============================================
X* v1.0	06/17/87 14:46	BVH	Wrote this comment.
X******************************************************************************/
X
X#include <stdio.h>
X
X#define	MAXCOL	78
X
X#undef SYSV
X
X#ifdef SYSV
X#define	srandom	srand
X#define	random	rand
X#endif
X
X#undef DRI
X
Xchar *emotion[] = {		/* ~E */
X    "Hope","Love","War","Peace","Pestilence","Plague","Lust","Justice",
X    "Travel","Cost of Living","Inflation","Oblivion","Television",
X    "Choice","Blind Beggars","Ugliness","Beauty","Bad Breath",
X    "Country Living","Utter Dullness","Pillow Talk","Evil","Good",
X    "Water","Air","Death","Situation Comedies","Supermarket Rags",
X    "Rock and Roll","Light","Dark","Knowledge","Anatomy","Psyche",
X    "Vengeance","Destruction","Wallpaper","Wisdom","Babysitters",
X    "Drinking","Filth","Flat Squirrels on the Highway","Gossip about ~N",
X    "Dumb Novelty Programs (like this one)"
X};
X
Xchar *whatis[] = {		/* ~W */
X    "the Ram","the Bull","the Fish","the Crab","the Centaur","the Virgin",
X    "the Scorpion","the Water Bearer","the Twin","the Lion","the Turtle",
X    "the Merciless","the Scourge of Heaven","the Patron of ~E",
X    "the Guardian of ~E","the Goddess of ~E","the God of ~E",
X    "the Horse","the Birdman of Alcatraz","the Source of All ~E",
X    "the Jedi Master","the WWF Champion","the Comic Sensation",
X    "the ~N Lookalike","the Wise","the Small","the Elder",
X    "Scion of the Elder Race","the One with the Power of ~E",
X    "the One who Brings ~E","the One Who Fights ~E",
X    "the Polka Dotted","the Consort of ~W","the Ruler of ~E",
X    "the One who Predicts That ~P","the Sucker of Dust","the Twin Tower",
X    "the One and Only","the Speaker for ~E","the Gweat and Powerful",
X    "the Psychic","the Elvis Impersonator","the System Administrator",
X    "the Earth Mother","~N's Mentor","the Big Baby",
X    "the One Who Resembles ~W","the One Who Has Seen ~W From Afar",
X    "the Car","the Albatross","the Penguin","the Joker","the Riddler"
X};
X
Xchar *whois[] = {		/* ~N */
X    "Aries","Cancer","Gemini","Taurus","Scorpio","Leo","Pisces","Libra",
X    "Aquarius","Virgo","Emperor Chung","Jean Dixon","The Amazing Kreskin",
X    "Soupy Sales","Saturn","Jupiter","Mercury","Chronos","Pluto","Hel",
X    "Mars","Venus","Gaia","Uranus","Chthon","Neptune","Zarkov","Flash Gordon",
X    "Margaret Thatcher","Ronald Reagan","Howdy Doody","Lot O. Droyd",
X    "Obiwan Kenobi","Yoda","Thor","Zeus","Odin","Scooby Doo","Papa Smurf",
X    "Yogi Bear","Regina","Renaldi","Elijawon","Jason","Elvis","Oz",
X    "Glinda","Manitoba","Penacook","Sitting Bull","Sunny Kirsten",
X    "Cheryl","Ray Frank","Ken Arndt","Kral","George ~N Washington",
X    "~N ( ~W ) ~N","He-Man","She-Ra","Cinderella","Prince Charming",
X    "Godzilla","Gamera","King Kong","She-Mommy","Nostradamus","Einstein",
X    "Houdini","My Mother"
X
X#ifdef DRI
X    ,"~D","~D","~D","~D","~D","~D","~D","~D",
X    "~D (aka ~N)"
X};
X
Xchar *dri[] = {				/* ~D */
X    "Adam Messer","Andrea McDonald","Bill Tyler","Bruce Holloway",
X    "Christina Shaw","Curt Geske","Dan Erickson","Dan Riddel-Kaufman",
X    "Dick Williams","Frank Holsworth","Gary Kildall","Greg Pachner",
X    "Greg Rossi","Gregg Morris","Henri Socha","Jeff Newman","Joe Guzaitas",
X    "Karl (Erick) Braun","Ken Belanger","Larry Towner","Lowell Webster",
X    "Marilyn Bohl","Mark Alexander","Mike Bailey","Mike Franusich",
X    "Mike MacLeod","Nancy Zentner","Peter Bolton","Renate Heisler",
X    "Rob Patten","Robert Bruce","Russ Weiser","Stan McKee","Steve Cavender",
X    "Stephanie Horoszko","Steve Toner","Tony Harris","Wayne Davison"
X#endif
X
X};
X
Xchar *predicts[] = {		/* ~P */
X    "you have dreamed that ~P. You will have such dreams again",
X    "your nose is oddly formed, and your eyes are of different color",
X    "you have contracted a fatal illness, but your belief in ~N, ~W, will pull you through",
X    "you will donate all your worldy possessions to ~N, ~W. You align yourself correctly for the coming jihad",
X    "your phone will ring soon. It will be someone whom you aren't looking at, or ~W. If the latter, leave a message at the tone",
X    "you will die before you finish reading this prediction, unless ~N smiles on you. If you DO survive, ~W will require a sacrifice before you learn that ~P",
X    "you are not satisfied with life",
X    "you often have fits of depression and feelings of uselessness",
X    "you harbor a secret desire to become ~W. Hide these feelings",
X    "your karma is troubled",
X    "the Force is strong in you",
X    "your phone is not ringing",
X    "you will not die before you finish reading this prediction",
X    "you will take a long trip soon",
X    "you feel you are not living up to your potential",
X    "you are not satisfied with your position",
X    "your situation is improving",
X    "you have contracted a fatal illness and will die",
X    "you will be contacted by aliens within the year. You may not recognize them, though they will give you clear signs",
X    "you will buy something from the Home Shopping Network",
X    "you will win ~$ dollars with LOTTO-DROID. Make obeisance to ~W",
X    "you will change your name three times in the next three years. You will not change it to ~N. Yet, ~W will continue to influence your every move",
X    "people say ~P",
X    "you must shun ~W at all turns. Be vigilant in this",
X    "you must not believe predictions from cheap programs like this one. Look to ~N for clear truth",
X    "your terminal is straining your eyes",
X    "your hair is changing color. Also, ~P",
X    "good fortune awaits you around every corner",
X    "it's not what you do, it's how you do it",
X    "your good fortune is at an end. Look to ~N, ~W, for guidance",
X    "your life has already peaked. You are on a long, downward slide",
X    "you have a brilliant future ahead of you. But rest not; ~P",
X    "you have an ardent desire to add more predictions to this program. Hold that thought, and ~N, ~W, predicts that ~P",
X    "you will be fired for spending so much time playing with a cheap little program like this one"
X};
X
Xchar *fullthing[] = {
X    "Listen! ~W has seen that ~P! Prove ~N wrong, and instead, ~P.",
X    "Logout immediately! I, ~N, ~W, have seen that ~P! However, ~P.",
X    "I've heard that ~P. To avoid this fate, buy the seven Books of ~W, and ~N will smile upon you once again, and you will find that ~P.",
X    "Heretic! Listen not to the simpleminded aphorisms of ~N! Only ~N, ~W, can help! Heed this, or I predict that ~P!",
X    "~N, ~W, has said that ~P.",
X    "I have received a psychic message from ~W, who says that ~P. If so, ~N forsees that ~P. This is true. Do not ignore this, or ~N, ~W, will become extremely angry.",
X    "Your biorythm is in turmoil. ~N, ~W, has the answers.",
X    "Other soothsayers tell untruths. ~N has the answers. Worship ~W, and you will find that ~P.",
X    "~N, ~W, knows that ~P. And much more. Send money.",
X    "Bathe in the presence of ~N, and know that ~P.",
X    "Beware, ~W has said that ~P, but ~P.",
X    "\"I predict that ~P\", says ~N, ~W. Listen well, for ~P.",
X    "Know that ~P. All this ~N has seen. Remember, ~W is never wrong. As a token of truth, ~P.",
X    "Run this program again, and find that ~P.",
X    "An urgent message from ~W! Ignore this, and find that ~P. But listen well, and hang a token of ~N, ~W, about your neck, for ~P."
X};
X
X#define	NUME	((sizeof emotion)/sizeof(char *))
X#define	NUMW	((sizeof whatis)/sizeof(char *))
X#define	NUMN	((sizeof whois)/sizeof(char *))
X#define	NUMP	((sizeof predicts)/sizeof(char *))
X#define	NUMF	((sizeof fullthing)/sizeof(char *))
X
X#ifdef DRI
X#define	NUMD	((sizeof dri)/sizeof(char *))
X#endif
X
Xint col = 0, nump = 3;
Xchar token[256];
X
Xmain(acnt,avar)
Xint acnt;
Xchar *avar[];
X{
X    int i, f;
X
X    srandom(time(0L));
X    if(acnt > 1) nump = atoi(avar[1]);
X    for(i=0; i<nump; ++i){
X	tokenize(fullthing[rnd(NUMF)]);
X	printf("\n\n");
X	col = 0;
X	}
X}
X
Xint isspace(ch)
Xint ch;
X{
X    return(ch == ' ');
X}
X
Xint rnd(n)
Xint n;
X{
X    return((random() & 0x7FFF) % n);
X}
X
Xtokenize(s)
Xchar *s;
X{
X    char tmptok[256];
X    char *s1;
X    int l;
X
Xfor(;;){
X
X    while(isspace(*s)) ++s;
X    if(!*s) return;
X    for(s1=token; *s && !isspace(*s);) *s1++ = *s++;
X    *s1++ = ' ';
X    *s1 = 0;
X    l = (s1-token);
X    if(l > 1 && token[0] == '~'){
X	switch(token[1]){
X	    case '$':
X		sprintf(tmptok,"$%d%02d.00",rnd(10000),rnd(100));
X		break;
X#ifdef DRI
X	    case 'D':
X		strcpy(tmptok,dri[rnd(NUMD)]);
X		break;
X#endif
X	    case 'E':
X		strcpy(tmptok,emotion[rnd(NUME)]);
X		break;
X	    case 'W':
X		strcpy(tmptok,whatis[rnd(NUMW)]);
X		break;
X	    case 'N':
X		strcpy(tmptok,whois[rnd(NUMN)]);
X		break;
X	    case 'P':
X		strcpy(tmptok,predicts[rnd(NUMP)]);
X		break;
X	    default:
X		strcpy(tmptok,">>WHOOPS<<");
X		break;
X	    }
X	strcat(tmptok,&token[2]);
X	tokenize(tmptok);
X	continue;
X	}
X    if((col + l) > MAXCOL){
X	printf("\n");
X	col = 0;
X	}
X    printf("%s",token);
X    col += l;
X    }
X}
END_OF_psychic.c
if test 9493 -ne `wc -c <psychic.c`; then
    echo shar: \"psychic.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0