home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 138.lha / Cycle / Vertigo.c < prev   
C/C++ Source or Header  |  1986-11-20  |  754b  |  35 lines

  1. /* Another simple player. "Vertigo" will try to turn if she is moving
  2.  * horizontally, but prefers to continue with her currnet heading if moving
  3.  * vertically. In other words, Vertigo prefers the vertical directions.
  4.  */
  5. #include "cycles.h"
  6.  
  7. char player_name[] = "Vertigo";
  8.  
  9. strategy_init() {}
  10. strategy_finish() {}
  11.  
  12. strategy()
  13. {
  14.   long x,y,dir;
  15.  
  16.   GetInfo(&x,&y,&dir);
  17.   /* (dir & 1) is true for left and right */
  18.   if (dir & 1) {
  19.     if (!Look(TURN_RIGHT(dir)))
  20.       return(TURN_RIGHT(dir));
  21.     else if (!Look(TURN_LEFT(dir)))
  22.       return(TURN_LEFT(dir));
  23.     else
  24.       return(dir);
  25.   }
  26.   else {
  27.     if (!Look(dir))
  28.       return(dir);
  29.     else if (!Look(TURN_RIGHT(dir)))
  30.       return(TURN_RIGHT(dir));
  31.     else
  32.       return(TURN_LEFT(dir));
  33.   }
  34. }
  35.