home *** CD-ROM | disk | FTP | other *** search
- /*
- "Round the clock" is a lightweight - he looks at all the cells around his
- current position up to four cells away. A sum is computed for the cells in
- each direction, with the closer cells receiving a greater weight. The
- direction with the lowest "score" is then chosen. Such a strategy can be
- effective, but you must resist looking too many layers away and spending
- too long computing the next move.
- */
- #include "cycles.h"
-
- char player_name[] = "Round the Clock";
-
- long xdir[] = {0,1,0,-1};
- long ydir[] = {-1,0,1,0};
-
- strategy_init() {}
- strategy_finish() {}
-
- strategy()
- {
- long x,y,dir;
- long score,best;
- long i,j;
-
- GetInfo(&x,&y,&dir);
-
- best = 1000; /* bigger than biggest possible score */
- for (i=0; i<4; i++) {
- if (Look(i)) continue;
- score = 0;
- for (j=2; j<4; j++)
- score += Inquire(x + j*xdir[i],y+ j*ydir[i]);
- if (score < best) {
- best = score;
- dir = i;
- }
- }
- return(dir);
- }
-