home *** CD-ROM | disk | FTP | other *** search
/ The CIA World Factbook 1992 / k3bimage.iso / sel / 04 / 0009 / clairvoy.c next >
Encoding:
C/C++ Source or Header  |  1991-12-02  |  1.7 KB  |  53 lines

  1. /* clairvoy.c -- clairvoyance function for Targ-Hurt ESP Trainer
  2.  
  3.    History: rhs 14-mar-87
  4. */
  5.  
  6. #include "mancon.h"
  7. #include "declares.h"
  8.  
  9. void mode_clairvoyance()
  10. {  int keypress, machine_sel, dummy;
  11.  
  12.    disp_cls();
  13.    disp_top("Clairvoyance");
  14.    disp_cbot();
  15.    srand( (unsigned)readclock(&dummy) ); /* Randomize first random number */
  16.                                          /* readclock is a function which
  17.                                             reads the system clock.  In this
  18.                                             application, its output is 
  19.                                             suitable for seeding a random
  20.                                             number generator because it
  21.                                             seldom returns the same value. */
  22.    disp_cursor(OFF);                     /* Make the cursor invisible. */
  23.    keypress = START;
  24.    while(keypress != QUIT)
  25.    {  machine_sel = rand()%4;          /* Get random number from 0 to 3 */
  26.  
  27.       keypress = pf_getcode();
  28.       switch(keypress)
  29.       {  case PASS:  thud();
  30.                      pf_newdirec(machine_sel);
  31.                      pf_display();
  32.                      break;
  33.          case QUIT:  pf_resetscore();
  34.                      disp_cls();   
  35.                      disp_cursor(ON);
  36.                      break;
  37.          case RESET: pf_resetscore();
  38.                      pf_display();
  39.                      break;
  40.          case CHANGE:break;
  41.          default:    thud();
  42.                      pf_newscore(keypress, machine_sel);
  43.                      pf_display();
  44.                      break;
  45.       }
  46.    }
  47. } /* end mode_clairvoyance() */
  48.  
  49.  
  50.  
  51.  
  52.  
  53.