-/* $NetBSD: makemove.c,v 1.3 1997/01/03 01:35:29 cgd Exp $ */
+/* $NetBSD: makemove.c,v 1.7 2003/08/07 09:37:17 agc Exp $ */
/*
* Copyright (c) 1994
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95";
#else
-static char rcsid[] = "$NetBSD: makemove.c,v 1.3 1997/01/03 01:35:29 cgd Exp $";
+__RCSID("$NetBSD: makemove.c,v 1.7 2003/08/07 09:37:17 agc Exp $");
#endif
#endif /* not lint */
#include "gomoku.h"
/* direction deltas */
-int dd[4] = {
+const int dd[4] = {
MRIGHT, MRIGHT+MDOWN, MDOWN, MDOWN+MLEFT
};
-int weight[5] = { 0, 1, 7, 22, 100 };
+const int weight[5] = { 0, 1, 7, 22, 100 };
/*
* Return values:
* MOVEOK everything is OK.
* RESIGN Player resigned.
* ILLEGAL Illegal move.
- * WIN The the winning move was just played.
+ * WIN The winning move was just played.
* TIE The game is a tie.
*/
+int
makemove(us, mv)
int us, mv;
{
- register struct spotstr *sp, *fsp;
- register union comboval *cp;
+ struct spotstr *sp, *fsp;
+ union comboval *cp;
struct spotstr *osp;
struct combostr *cbp, *cbp1;
union comboval *cp1;
- register int i, f, r, d, n;
+ int i, f, r, d, n;
int space, val, bmask;
/* check for end of game */
/*
* fix up the overlap array due to updating spot osp.
*/
+void
update_overlap(osp)
struct spotstr *osp;
{
- register struct spotstr *sp, *sp1, *sp2;
- register int i, f, r, r1, d, d1, n;
+ struct spotstr *sp, *sp1, *sp2;
+ int i, f, r, r1, d, d1, n;
int a, b, bmask, bmask1;
struct spotstr *esp;
char *str;
+ esp = NULL;
for (r = 4; --r >= 0; ) { /* for each direction */
d = dd[r];
sp1 = osp;