]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - robots/auto.c
Use mkstemp to make the temporary files used when you win.
[bsdgames-darwin.git] / robots / auto.c
index 29bba2591274075981dd3c5e707e7ee282119859..ff80ba0d62e16be07119d717c67f67aefe3b9b05 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: auto.c,v 1.5 2002/01/31 17:35:52 christos Exp $        */
+/*     $NetBSD: auto.c,v 1.7 2004/08/27 09:06:25 christos Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  *     Algo : 
  *             IF scrapheaps don't exist THEN
  *                     IF not in danger THEN 
- *                             stay at current position;
- *                     ELSE move away from the closest robot;
+ *                             stay at current position
+ *                     ELSE
+ *                             move away from the closest robot
  *                     FI
  *             ELSE 
- *                     find closest heap;
- *                     find closest robot;
- *                     IF scrapheap is adjacenHEN
- *                                     move behind the scrapheap
- *                             ELSE
- *                                     move away from the closest robot
- *                             FI
+ *                     find closest heap
+ *                     find closest robot
+ *                     IF scrapheap is adjacent THEN
+ *                             move behind the scrapheap
  *                     ELSE
  *                             take the move that takes you away from the
  *                             robots and closest to the heap
 
 #define CONSDEBUG(a)
 
-static int distance __P((int, int, int, int));
-static int xinc __P((int));
-static int yinc __P((int));
-static const char *find_moves __P((void));
-static COORD *closest_robot __P((int *));
-static COORD *closest_heap __P((int *));
-static char move_towards __P((int, int));
-static char move_away __P((COORD *));
-static char move_between __P((COORD *, COORD *));
-static int between __P((COORD *, COORD *));
+static int distance(int, int, int, int);
+static int xinc(int);
+static int yinc(int);
+static const char *find_moves(void);
+static COORD *closest_robot(int *);
+static COORD *closest_heap(int *);
+static char move_towards(int, int);
+static char move_away(COORD *);
+static char move_between(COORD *, COORD *);
+static int between(COORD *, COORD *);
 
 /* distance():
  *     return "move" number distance of the two coordinates