gomoku: remove write-only members from overlap_info
Since overlap_info is only used in pickmove.c, move it there. No functional change. In particular, in the middle of a game, gomoku still tends to fall into analysis paralysis, thinking about the best move for more than 3 minutes on modern hardware. Since the algorithm is basically unchanged since the 1990s, it must have been a long waiting time back then, probably an hour per move.
This commit is contained in:
parent
3189ab5b3f
commit
20e9d475ef
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gomoku.h,v 1.23 2022/05/15 22:18:36 rillig Exp $ */
|
||||
/* $NetBSD: gomoku.h,v 1.24 2022/05/15 22:41:51 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994
|
||||
|
@ -174,7 +174,6 @@ struct combostr {
|
|||
#define C_OPEN_0 0x01 /* link[0] is an open ended frame */
|
||||
#define C_OPEN_1 0x02 /* link[1] is an open ended frame */
|
||||
#define C_LOOP 0x04 /* link[1] intersects previous frame */
|
||||
#define C_MARK 0x08 /* indicates combo processed */
|
||||
|
||||
/*
|
||||
* This structure is used for recording the completion points of
|
||||
|
@ -221,17 +220,6 @@ struct spotstr {
|
|||
#define BFLAG 0x010000 /* frame intersects border or dead */
|
||||
#define BFLAGALL 0x0F0000 /* all frames dead */
|
||||
|
||||
/*
|
||||
* This structure is used to store overlap information between frames.
|
||||
*/
|
||||
struct overlap_info {
|
||||
int o_intersect; /* intersection spot */
|
||||
struct combostr *o_fcombo; /* the connecting combo */
|
||||
u_char o_link; /* which link to update (0 or 1) */
|
||||
u_char o_off; /* offset in frame of intersection */
|
||||
u_char o_frameindex; /* intersection frame index */
|
||||
};
|
||||
|
||||
extern const char *letters;
|
||||
extern const char pdir[];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pickmove.c,v 1.26 2022/05/15 22:18:36 rillig Exp $ */
|
||||
/* $NetBSD: pickmove.c,v 1.27 2022/05/15 22:41:51 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pickmove.c,v 1.26 2022/05/15 22:18:36 rillig Exp $");
|
||||
__RCSID("$NetBSD: pickmove.c,v 1.27 2022/05/15 22:41:51 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -55,6 +55,15 @@ __RCSID("$NetBSD: pickmove.c,v 1.26 2022/05/15 22:18:36 rillig Exp $");
|
|||
#define BIT_CLR(a, b) ((a)[(b)/BITS_PER_INT] &= ~(1 << ((b) % BITS_PER_INT)))
|
||||
#define BIT_TEST(a, b) ((a)[(b)/BITS_PER_INT] & (1 << ((b) % BITS_PER_INT)))
|
||||
|
||||
/*
|
||||
* This structure is used to store overlap information between frames.
|
||||
*/
|
||||
struct overlap_info {
|
||||
int o_intersect; /* intersection spot */
|
||||
u_char o_off; /* offset in frame of intersection */
|
||||
u_char o_frameindex; /* intersection frame index */
|
||||
};
|
||||
|
||||
static struct combostr *hashcombos[FAREA];/* hash list for finding duplicates */
|
||||
static struct combostr *sortcombos; /* combos at higher levels */
|
||||
static int combolen; /* number of combos in sortcombos */
|
||||
|
@ -1148,8 +1157,6 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp,
|
|||
return -1; /* invalid overlap */
|
||||
|
||||
vertices->o_intersect = n;
|
||||
vertices->o_fcombo = cbp;
|
||||
vertices->o_link = 1;
|
||||
vertices->o_off = (n - tcbp->c_vertex) /
|
||||
dd[tcbp->c_dir];
|
||||
vertices->o_frameindex = myindex;
|
||||
|
@ -1198,8 +1205,6 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp,
|
|||
return -1; /* invalid overlap */
|
||||
|
||||
vertices->o_intersect = n;
|
||||
vertices->o_fcombo = lcbp;
|
||||
vertices->o_link = 0;
|
||||
vertices->o_off = (n - cbp->c_vertex) /
|
||||
dd[cbp->c_dir];
|
||||
vertices->o_frameindex = 0;
|
||||
|
|
Loading…
Reference in New Issue