home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume1 / psychic / psychic.c
C/C++ Source or Header  |  1987-06-29  |  9KB  |  243 lines

  1. /*****************************************************************************
  2. *    PSYCHIC.C                           Version 1.0
  3. *
  4. *    This program is attuned to the Powers of the Ancients, and the
  5. *    Mysterious Forces which Shape our Destiny. With This Program, You
  6. *    will Be Privy to the same Sources of Knowledge and Mystic Oracles
  7. *    used by Ancient Astronauts.
  8. *
  9. *    Know that this Font of Wisdom will work on BSD Unix Systems Unmodified,
  10. *    but the Ancients have Decreed that you must change "#undef SYSV" to
  11. *    "#define SYSV" in the Line Below if you have the System of Fives.
  12. *
  13. *    When        Who    Why
  14. *    ==============    =======    ==============================================
  15. * v1.0    06/17/87 14:46    BVH    Wrote this comment.
  16. ******************************************************************************/
  17.  
  18. #include <stdio.h>
  19.  
  20. #define    MAXCOL    78
  21.  
  22. #undef SYSV
  23.  
  24. #ifdef SYSV
  25. #define    srandom    srand
  26. #define    random    rand
  27. #endif
  28.  
  29. #undef DRI
  30.  
  31. char *emotion[] = {        /* ~E */
  32.     "Hope","Love","War","Peace","Pestilence","Plague","Lust","Justice",
  33.     "Travel","Cost of Living","Inflation","Oblivion","Television",
  34.     "Choice","Blind Beggars","Ugliness","Beauty","Bad Breath",
  35.     "Country Living","Utter Dullness","Pillow Talk","Evil","Good",
  36.     "Water","Air","Death","Situation Comedies","Supermarket Rags",
  37.     "Rock and Roll","Light","Dark","Knowledge","Anatomy","Psyche",
  38.     "Vengeance","Destruction","Wallpaper","Wisdom","Babysitters",
  39.     "Drinking","Filth","Flat Squirrels on the Highway","Gossip about ~N",
  40.     "Dumb Novelty Programs (like this one)"
  41. };
  42.  
  43. char *whatis[] = {        /* ~W */
  44.     "the Ram","the Bull","the Fish","the Crab","the Centaur","the Virgin",
  45.     "the Scorpion","the Water Bearer","the Twin","the Lion","the Turtle",
  46.     "the Merciless","the Scourge of Heaven","the Patron of ~E",
  47.     "the Guardian of ~E","the Goddess of ~E","the God of ~E",
  48.     "the Horse","the Birdman of Alcatraz","the Source of All ~E",
  49.     "the Jedi Master","the WWF Champion","the Comic Sensation",
  50.     "the ~N Lookalike","the Wise","the Small","the Elder",
  51.     "Scion of the Elder Race","the One with the Power of ~E",
  52.     "the One who Brings ~E","the One Who Fights ~E",
  53.     "the Polka Dotted","the Consort of ~W","the Ruler of ~E",
  54.     "the One who Predicts That ~P","the Sucker of Dust","the Twin Tower",
  55.     "the One and Only","the Speaker for ~E","the Gweat and Powerful",
  56.     "the Psychic","the Elvis Impersonator","the System Administrator",
  57.     "the Earth Mother","~N's Mentor","the Big Baby",
  58.     "the One Who Resembles ~W","the One Who Has Seen ~W From Afar",
  59.     "the Car","the Albatross","the Penguin","the Joker","the Riddler"
  60. };
  61.  
  62. char *whois[] = {        /* ~N */
  63.     "Aries","Cancer","Gemini","Taurus","Scorpio","Leo","Pisces","Libra",
  64.     "Aquarius","Virgo","Emperor Chung","Jean Dixon","The Amazing Kreskin",
  65.     "Soupy Sales","Saturn","Jupiter","Mercury","Chronos","Pluto","Hel",
  66.     "Mars","Venus","Gaia","Uranus","Chthon","Neptune","Zarkov","Flash Gordon",
  67.     "Margaret Thatcher","Ronald Reagan","Howdy Doody","Lot O. Droyd",
  68.     "Obiwan Kenobi","Yoda","Thor","Zeus","Odin","Scooby Doo","Papa Smurf",
  69.     "Yogi Bear","Regina","Renaldi","Elijawon","Jason","Elvis","Oz",
  70.     "Glinda","Manitoba","Penacook","Sitting Bull","Sunny Kirsten",
  71.     "Cheryl","Ray Frank","Ken Arndt","Kral","George ~N Washington",
  72.     "~N ( ~W ) ~N","He-Man","She-Ra","Cinderella","Prince Charming",
  73.     "Godzilla","Gamera","King Kong","She-Mommy","Nostradamus","Einstein",
  74.     "Houdini","My Mother"
  75.  
  76. #ifdef DRI
  77.     ,"~D","~D","~D","~D","~D","~D","~D","~D",
  78.     "~D (aka ~N)"
  79. };
  80.  
  81. char *dri[] = {                /* ~D */
  82.     "Adam Messer","Andrea McDonald","Bill Tyler","Bruce Holloway",
  83.     "Christina Shaw","Curt Geske","Dan Erickson","Dan Riddel-Kaufman",
  84.     "Dick Williams","Frank Holsworth","Gary Kildall","Greg Pachner",
  85.     "Greg Rossi","Gregg Morris","Henri Socha","Jeff Newman","Joe Guzaitas",
  86.     "Karl (Erick) Braun","Ken Belanger","Larry Towner","Lowell Webster",
  87.     "Marilyn Bohl","Mark Alexander","Mike Bailey","Mike Franusich",
  88.     "Mike MacLeod","Nancy Zentner","Peter Bolton","Renate Heisler",
  89.     "Rob Patten","Robert Bruce","Russ Weiser","Stan McKee","Steve Cavender",
  90.     "Stephanie Horoszko","Steve Toner","Tony Harris","Wayne Davison"
  91. #endif
  92.  
  93. };
  94.  
  95. char *predicts[] = {        /* ~P */
  96.     "you have dreamed that ~P. You will have such dreams again",
  97.     "your nose is oddly formed, and your eyes are of different color",
  98.     "you have contracted a fatal illness, but your belief in ~N, ~W, will pull you through",
  99.     "you will donate all your worldy possessions to ~N, ~W. You align yourself correctly for the coming jihad",
  100.     "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",
  101.     "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",
  102.     "you are not satisfied with life",
  103.     "you often have fits of depression and feelings of uselessness",
  104.     "you harbor a secret desire to become ~W. Hide these feelings",
  105.     "your karma is troubled",
  106.     "the Force is strong in you",
  107.     "your phone is not ringing",
  108.     "you will not die before you finish reading this prediction",
  109.     "you will take a long trip soon",
  110.     "you feel you are not living up to your potential",
  111.     "you are not satisfied with your position",
  112.     "your situation is improving",
  113.     "you have contracted a fatal illness and will die",
  114.     "you will be contacted by aliens within the year. You may not recognize them, though they will give you clear signs",
  115.     "you will buy something from the Home Shopping Network",
  116.     "you will win ~$ dollars with LOTTO-DROID. Make obeisance to ~W",
  117.     "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",
  118.     "people say ~P",
  119.     "you must shun ~W at all turns. Be vigilant in this",
  120.     "you must not believe predictions from cheap programs like this one. Look to ~N for clear truth",
  121.     "your terminal is straining your eyes",
  122.     "your hair is changing color. Also, ~P",
  123.     "good fortune awaits you around every corner",
  124.     "it's not what you do, it's how you do it",
  125.     "your good fortune is at an end. Look to ~N, ~W, for guidance",
  126.     "your life has already peaked. You are on a long, downward slide",
  127.     "you have a brilliant future ahead of you. But rest not; ~P",
  128.     "you have an ardent desire to add more predictions to this program. Hold that thought, and ~N, ~W, predicts that ~P",
  129.     "you will be fired for spending so much time playing with a cheap little program like this one"
  130. };
  131.  
  132. char *fullthing[] = {
  133.     "Listen! ~W has seen that ~P! Prove ~N wrong, and instead, ~P.",
  134.     "Logout immediately! I, ~N, ~W, have seen that ~P! However, ~P.",
  135.     "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.",
  136.     "Heretic! Listen not to the simpleminded aphorisms of ~N! Only ~N, ~W, can help! Heed this, or I predict that ~P!",
  137.     "~N, ~W, has said that ~P.",
  138.     "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.",
  139.     "Your biorythm is in turmoil. ~N, ~W, has the answers.",
  140.     "Other soothsayers tell untruths. ~N has the answers. Worship ~W, and you will find that ~P.",
  141.     "~N, ~W, knows that ~P. And much more. Send money.",
  142.     "Bathe in the presence of ~N, and know that ~P.",
  143.     "Beware, ~W has said that ~P, but ~P.",
  144.     "\"I predict that ~P\", says ~N, ~W. Listen well, for ~P.",
  145.     "Know that ~P. All this ~N has seen. Remember, ~W is never wrong. As a token of truth, ~P.",
  146.     "Run this program again, and find that ~P.",
  147.     "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."
  148. };
  149.  
  150. #define    NUME    ((sizeof emotion)/sizeof(char *))
  151. #define    NUMW    ((sizeof whatis)/sizeof(char *))
  152. #define    NUMN    ((sizeof whois)/sizeof(char *))
  153. #define    NUMP    ((sizeof predicts)/sizeof(char *))
  154. #define    NUMF    ((sizeof fullthing)/sizeof(char *))
  155.  
  156. #ifdef DRI
  157. #define    NUMD    ((sizeof dri)/sizeof(char *))
  158. #endif
  159.  
  160. int col = 0, nump = 3;
  161. char token[256];
  162.  
  163. main(acnt,avar)
  164. int acnt;
  165. char *avar[];
  166. {
  167.     int i, f;
  168.  
  169.     srandom(time(0L));
  170.     if(acnt > 1) nump = atoi(avar[1]);
  171.     for(i=0; i<nump; ++i){
  172.     tokenize(fullthing[rnd(NUMF)]);
  173.     printf("\n\n");
  174.     col = 0;
  175.     }
  176. }
  177.  
  178. int isspace(ch)
  179. int ch;
  180. {
  181.     return(ch == ' ');
  182. }
  183.  
  184. int rnd(n)
  185. int n;
  186. {
  187.     return((random() & 0x7FFF) % n);
  188. }
  189.  
  190. tokenize(s)
  191. char *s;
  192. {
  193.     char tmptok[256];
  194.     char *s1;
  195.     int l;
  196.  
  197. for(;;){
  198.  
  199.     while(isspace(*s)) ++s;
  200.     if(!*s) return;
  201.     for(s1=token; *s && !isspace(*s);) *s1++ = *s++;
  202.     *s1++ = ' ';
  203.     *s1 = 0;
  204.     l = (s1-token);
  205.     if(l > 1 && token[0] == '~'){
  206.     switch(token[1]){
  207.         case '$':
  208.         sprintf(tmptok,"$%d%02d.00",rnd(10000),rnd(100));
  209.         break;
  210. #ifdef DRI
  211.         case 'D':
  212.         strcpy(tmptok,dri[rnd(NUMD)]);
  213.         break;
  214. #endif
  215.         case 'E':
  216.         strcpy(tmptok,emotion[rnd(NUME)]);
  217.         break;
  218.         case 'W':
  219.         strcpy(tmptok,whatis[rnd(NUMW)]);
  220.         break;
  221.         case 'N':
  222.         strcpy(tmptok,whois[rnd(NUMN)]);
  223.         break;
  224.         case 'P':
  225.         strcpy(tmptok,predicts[rnd(NUMP)]);
  226.         break;
  227.         default:
  228.         strcpy(tmptok,">>WHOOPS<<");
  229.         break;
  230.         }
  231.     strcat(tmptok,&token[2]);
  232.     tokenize(tmptok);
  233.     continue;
  234.     }
  235.     if((col + l) > MAXCOL){
  236.     printf("\n");
  237.     col = 0;
  238.     }
  239.     printf("%s",token);
  240.     col += l;
  241.     }
  242. }
  243.