-/* $NetBSD: auto.c,v 1.1 1999/05/15 23:56:35 christos Exp $ */
+/* $NetBSD: auto.c,v 1.4 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
#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 *));
/* distance():
* return "move" number distance of the two coordinates
/* find_moves():
* Find possible moves
*/
-static char *
+static const char *
find_moves()
{
int x, y;
COORD test;
- char *m, *a;
- static char moves[] = ".hjklyubn";
+ const char *m;
+ char *a;
+ static const char moves[] = ".hjklyubn";
static char ans[sizeof moves];
a = ans;
}
*a = 0;
if(ans[0])
- a = ans;
+ return ans;
else
- a = "t";
- return a;
+ return "t";
}
/* closest_robot():
closest_robot(dist)
int *dist;
{
- COORD *rob, *end, *minrob;
+ COORD *rob, *end, *minrob = NULL;
int tdist, mindist;
mindist = 1000000;
closest_heap(dist)
int *dist;
{
- COORD *hp, *end, *minhp;
+ COORD *hp, *end, *minhp = NULL;
int mindist, tdist;
mindist = 1000000;
COORD *rob;
COORD *hp;
{
- char ok_moves[10], best_move;
- char *ptr;
- int move_judge, cur_judge, dx, dy, mvx, mvy;
+ int dx, dy;
float slope, cons;
/* equation of the line between us and the closest robot */
return move_between(robot_close, heap_close);
#endif
-} /* end get_move */
+} /* end automove */