home *** CD-ROM | disk | FTP | other *** search
- /* precog.c -- precognition function for Targ-Hurt ESP Trainer
-
- History: rhs 18-mar-87
- */
-
- #include "mancon.h"
- #include "declares.h"
-
- void mode_precognition()
- { int keypress, machine_sel, dummy;
- static int delay=10;
-
- disp_cls();
- disp_top("Precognition");
- disp_pbot();
- srand( (unsigned)readclock(&dummy) ); /* Randomize first random number */
- /* readclock is a function which
- reads the system clock. In this
- application, its output is
- suitable for seeding a random
- number generator because it
- seldom returns the same value. */
- disp_cursor(OFF); /* Make cursor invisible. */
- keypress = START;
- while(keypress != QUIT)
- {
- keypress = pf_getcode(); /* Get user input, then wait. */
- if(keypress==NORTH || keypress==SOUTH || keypress==EAST
- || keypress==WEST || keypress==PASS)
- {
- pf_waitmsg(ON, (keypress==PASS) ? " Pass Noted" :
- " Selection Noted");
- wait(delay/2);
- pf_waitmsg(OFF,"");
- wait(delay/2);
-
- machine_sel = rand()%4; /* Get random number from 0 to 3 */
- }
-
- switch(keypress)
- { case PASS: thud();
- pf_newdirec(machine_sel);
- pf_display();
- break;
- case QUIT: pf_resetscore();
- disp_cls(); /* Clear the screen. */
- disp_cursor(ON);
- break;
- case RESET: pf_resetscore();
- pf_display();
- break;
- case CHANGE:pf_change_delay(&delay);
- break;
- default: thud();
- pf_newscore(keypress, machine_sel);
- pf_display();
- break;
- }
- }
- } /* end mode_precognition() */
-
-
-
-
-