From eff6047a366924e7f864e4f19335619f3236fce9 Mon Sep 17 00:00:00 2001 From: dholland Date: Thu, 4 Jun 2009 05:43:29 +0000 Subject: Increase spending on vowels. No object file diffs. --- gomoku/bdinit.c | 26 ++++++++++---------- gomoku/bdisp.c | 12 +++++----- gomoku/gomoku.h | 14 +++++------ gomoku/makemove.c | 14 +++++------ gomoku/pickmove.c | 72 +++++++++++++++++++++++++++---------------------------- 5 files changed, 69 insertions(+), 69 deletions(-) (limited to 'gomoku') diff --git a/gomoku/bdinit.c b/gomoku/bdinit.c index a601314a..93a58f49 100644 --- a/gomoku/bdinit.c +++ b/gomoku/bdinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdinit.c,v 1.6 2009/06/04 05:27:04 dholland Exp $ */ +/* $NetBSD: bdinit.c,v 1.7 2009/06/04 05:43:29 dholland Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)bdinit.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdinit.c,v 1.6 2009/06/04 05:27:04 dholland Exp $"); +__RCSID("$NetBSD: bdinit.c,v 1.7 2009/06/04 05:43:29 dholland Exp $"); #endif #endif /* not lint */ @@ -57,7 +57,7 @@ bdinit(struct spotstr *bp) sp = bp; for (i = BSZ2; --i >= 0; sp++) { sp->s_occ = BORDER; /* top border */ - sp->s_flg = BFLAGALL; + sp->s_flags = BFLAGALL; } /* fill entire board with EMPTY spots */ @@ -66,11 +66,11 @@ bdinit(struct spotstr *bp) for (j = 0; ++j < BSZ1; sp++) { /* for each row */ for (i = 0; ++i < BSZ1; sp++) { /* for each column */ sp->s_occ = EMPTY; - sp->s_flg = 0; + sp->s_flags = 0; sp->s_wval = 0; if (j < 5) { /* directions 1, 2, 3 are blocked */ - sp->s_flg |= (BFLAG << 1) | (BFLAG << 2) | + sp->s_flags |= (BFLAG << 1) | (BFLAG << 2) | (BFLAG << 3); sp->s_fval[BLACK][1].s = MAXCOMBO; sp->s_fval[BLACK][2].s = MAXCOMBO; @@ -97,7 +97,7 @@ bdinit(struct spotstr *bp) } if (i > (BSZ - 4)) { /* directions 0, 1 are blocked */ - sp->s_flg |= BFLAG | (BFLAG << 1); + sp->s_flags |= BFLAG | (BFLAG << 1); sp->s_fval[BLACK][0].s = MAXCOMBO; sp->s_fval[BLACK][1].s = MAXCOMBO; sp->s_fval[WHITE][0].s = MAXCOMBO; @@ -106,7 +106,7 @@ bdinit(struct spotstr *bp) sp->s_fval[BLACK][0].s = 0x500; sp->s_fval[WHITE][0].s = 0x500; /* if direction 1 is not blocked */ - if (!(sp->s_flg & (BFLAG << 1))) { + if (!(sp->s_flags & (BFLAG << 1))) { sp->s_fval[BLACK][1].s = 0x500; sp->s_fval[WHITE][1].s = 0x500; } @@ -115,11 +115,11 @@ bdinit(struct spotstr *bp) sp->s_fval[WHITE][0].s = 0x401; if (i < 5) { /* direction 3 is blocked */ - sp->s_flg |= (BFLAG << 3); + sp->s_flags |= (BFLAG << 3); sp->s_fval[BLACK][3].s = MAXCOMBO; sp->s_fval[WHITE][3].s = MAXCOMBO; } else if (i == 5 && - !(sp->s_flg & (BFLAG << 3))) { + !(sp->s_flags & (BFLAG << 3))) { sp->s_fval[BLACK][3].s = 0x500; sp->s_fval[WHITE][3].s = 0x500; } @@ -128,7 +128,7 @@ bdinit(struct spotstr *bp) * Allocate a frame structure for non blocked frames. */ for (r = 4; --r >= 0; ) { - if (sp->s_flg & (BFLAG << r)) + if (sp->s_flags & (BFLAG << r)) continue; cbp->c_combo.s = sp->s_fval[BLACK][r].s; cbp->c_vertex = sp - board; @@ -139,13 +139,13 @@ bdinit(struct spotstr *bp) } } sp->s_occ = BORDER; /* left & right border */ - sp->s_flg = BFLAGALL; + sp->s_flags = BFLAGALL; } /* mark the borders as such */ for (i = BSZ1; --i >= 0; sp++) { sp->s_occ = BORDER; /* bottom border */ - sp->s_flg = BFLAGALL; + sp->s_flags = BFLAGALL; } sortframes[BLACK] = (struct combostr *)0; @@ -207,7 +207,7 @@ init_overlap(void) for (f = 0; f < 6; f++, sp2 -= d2) { if (sp2->s_occ == BORDER) break; - if (sp2->s_flg & bmask) + if (sp2->s_flags & bmask) continue; n = sp2->s_frame[r] - frames; ip[n] = vertex; diff --git a/gomoku/bdisp.c b/gomoku/bdisp.c index 70297ce2..c7539968 100644 --- a/gomoku/bdisp.c +++ b/gomoku/bdisp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.10 2009/06/04 05:27:04 dholland Exp $ */ +/* $NetBSD: bdisp.c,v 1.11 2009/06/04 05:43:29 dholland Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.10 2009/06/04 05:27:04 dholland Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.11 2009/06/04 05:43:29 dholland Exp $"); #endif #endif /* not lint */ @@ -153,9 +153,9 @@ bdisp(void) move(BSZ1 - j, 2 * i + 1); sp = &board[i + j * BSZ1]; if (debug > 1 && sp->s_occ == EMPTY) { - if (sp->s_flg & IFLAGALL) + if (sp->s_flags & IFLAGALL) c = '+'; - else if (sp->s_flg & CFLAGALL) + else if (sp->s_flags & CFLAGALL) c = '-'; else c = '.'; @@ -186,9 +186,9 @@ bdump(FILE *fp) for (i = 1; i < BSZ1; i++) { sp = &board[i + j * BSZ1]; if (debug > 1 && sp->s_occ == EMPTY) { - if (sp->s_flg & IFLAGALL) + if (sp->s_flags & IFLAGALL) c = '+'; - else if (sp->s_flg & CFLAGALL) + else if (sp->s_flags & CFLAGALL) c = '-'; else c = '.'; diff --git a/gomoku/gomoku.h b/gomoku/gomoku.h index 0d9ff6e5..98ce26f8 100644 --- a/gomoku/gomoku.h +++ b/gomoku/gomoku.h @@ -1,4 +1,4 @@ -/* $NetBSD: gomoku.h,v 1.10 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: gomoku.h,v 1.11 2009/06/04 05:43:29 dholland Exp $ */ /* * Copyright (c) 1994 @@ -175,7 +175,7 @@ struct combostr { u_short c_vertex; /* C:intersection or F:frame head */ u_char c_nframes; /* number of frames in the combo */ u_char c_dir; /* C:loop frame or F:frame direction */ - u_char c_flg; /* C:combo flags */ + u_char c_flags; /* C:combo flags */ u_char c_frameindex; /* C:intersection frame index */ u_char c_framecnt[2]; /* number of frames left to attach */ u_char c_emask[2]; /* C:bit mask of completion spots for @@ -183,7 +183,7 @@ struct combostr { u_char c_voff[2]; /* C:vertex offset within frame */ }; -/* flag values for c_flg */ +/* flag values for c_flags */ #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 */ @@ -211,7 +211,7 @@ struct elist { struct spotstr { short s_occ; /* color of occupant */ short s_wval; /* weighted value */ - int s_flg; /* flags for graph walks */ + int s_flags; /* flags for graph walks */ struct combostr *s_frame[4]; /* level 1 combo for frame[dir] */ union comboval s_fval[2][4]; /* combo value for [color][frame] */ union comboval s_combo[2]; /* minimum combo value for BLK & WHT */ @@ -222,7 +222,7 @@ struct spotstr { int dummy[2]; /* XXX */ }; -/* flag values for s_flg */ +/* flag values for s_flags */ #define CFLAG 0x000001 /* frame is part of a combo */ #define CFLAGALL 0x00000F /* all frame directions marked */ #define IFLAG 0x000010 /* legal intersection point */ @@ -237,7 +237,7 @@ struct spotstr { /* * This structure is used to store overlap information between frames. */ -struct ovlp_info { +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) */ @@ -295,7 +295,7 @@ void makecombo(struct combostr *, struct spotstr *, int, int); void makecombo2(struct combostr *, struct spotstr *, int, int); int sortcombo(struct combostr **, struct combostr **, struct combostr *); int checkframes(struct combostr *, struct combostr *, struct spotstr *, - int, struct ovlp_info *); + int, struct overlap_info *); void addframes(int); void scanframes(int); int better(const struct spotstr *, const struct spotstr *, int); diff --git a/gomoku/makemove.c b/gomoku/makemove.c index e3b63428..c483aa9d 100644 --- a/gomoku/makemove.c +++ b/gomoku/makemove.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemove.c,v 1.9 2009/06/04 05:27:04 dholland Exp $ */ +/* $NetBSD: makemove.c,v 1.10 2009/06/04 05:43:29 dholland Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: makemove.c,v 1.9 2009/06/04 05:27:04 dholland Exp $"); +__RCSID("$NetBSD: makemove.c,v 1.10 2009/06/04 05:43:29 dholland Exp $"); #endif #endif /* not lint */ @@ -94,7 +94,7 @@ makemove(int us, int mv) for (f = 5; --f >= 0; fsp -= d) { /* for each frame */ if (fsp->s_occ == BORDER) goto nextr; - if (fsp->s_flg & bmask) + if (fsp->s_flags & bmask) continue; /* remove this frame from the sorted list of frames */ @@ -129,7 +129,7 @@ makemove(int us, int mv) sp->s_wval -= val; else { /* this frame is now blocked, adjust values */ - fsp->s_flg |= bmask; + fsp->s_flags |= bmask; fsp->s_fval[BLACK][r].s = MAXCOMBO; fsp->s_fval[WHITE][r].s = MAXCOMBO; while (--i >= 0) { @@ -232,7 +232,7 @@ update_overlap(struct spotstr *osp) for (f = 0; f < 6; f++, sp1 -= d) { /* for each frame */ if (sp1->s_occ == BORDER) break; - if (sp1->s_flg & bmask) + if (sp1->s_flags & bmask) continue; /* * Update all other frames that intersect the current one @@ -246,7 +246,7 @@ update_overlap(struct spotstr *osp) for (i = f + 1; i < 6; i++, sp2 -= d) { if (sp2->s_occ == BORDER) break; - if (sp2->s_flg & bmask) + if (sp2->s_flags & bmask) continue; /* * count the number of empty spots to see if there is @@ -293,7 +293,7 @@ update_overlap(struct spotstr *osp) for (i = 6; --i >= 0; sp -= d1) { /* for each spot */ if (sp->s_occ == BORDER) break; - if (sp->s_flg & bmask1) + if (sp->s_flags & bmask1) continue; b = sp->s_frame[r1] - frames; str[b] = 0; diff --git a/gomoku/pickmove.c b/gomoku/pickmove.c index 096ccb30..490edd18 100644 --- a/gomoku/pickmove.c +++ b/gomoku/pickmove.c @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.14 2009/06/04 05:27:04 dholland Exp $ */ +/* $NetBSD: pickmove.c,v 1.15 2009/06/04 05:43:29 dholland 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.14 2009/06/04 05:27:04 dholland Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.15 2009/06/04 05:43:29 dholland Exp $"); #endif #endif /* not lint */ @@ -84,7 +84,7 @@ pickmove(int us) sp->s_level[WHITE] = 255; sp->s_nforce[BLACK] = 0; sp->s_nforce[WHITE] = 0; - sp->s_flg &= ~(FFLAGALL | MFLAGALL); + sp->s_flags &= ~(FFLAGALL | MFLAGALL); } nforce = 0; memset(forcemap, 0, sizeof(forcemap)); @@ -319,7 +319,7 @@ scanframes(int color) } } /* mark frame as having been processed */ - board[cbp->c_vertex].s_flg |= MFLAG << r; + board[cbp->c_vertex].s_flags |= MFLAG << r; } while ((cbp = cbp->c_next) != ecbp); /* @@ -437,7 +437,7 @@ makecombo2(struct combostr *ocbp, struct spotstr *osp, int off, int s) for (f = 0; f < 5; f++, fsp -= d) { /* for each frame */ if (fsp->s_occ == BORDER) break; - if (fsp->s_flg & bmask) + if (fsp->s_flags & bmask) continue; /* don't include frames of the wrong color */ @@ -489,9 +489,9 @@ makecombo2(struct combostr *ocbp, struct spotstr *osp, int off, int s) ncbp->c_nframes = 2; ncbp->c_dir = 0; ncbp->c_frameindex = 0; - ncbp->c_flg = (ocb.c.b) ? C_OPEN_0 : 0; + ncbp->c_flags = (ocb.c.b) ? C_OPEN_0 : 0; if (fcb.c.b) - ncbp->c_flg |= C_OPEN_1; + ncbp->c_flags |= C_OPEN_1; ncbp->c_framecnt[0] = fcnt; ncbp->c_emask[0] = emask; ncbp->c_framecnt[1] = fcb.c.a - 2; @@ -574,7 +574,7 @@ addframes(int level) fsp = &board[cbp->c_vertex]; r = cbp->c_dir; /* skip frames that are part of a <1,x> combo */ - if (fsp->s_flg & (FFLAG << r)) + if (fsp->s_flags & (FFLAG << r)) continue; /* @@ -647,7 +647,7 @@ makecombo(struct combostr *ocbp, struct spotstr *osp, int off, int s) struct combostr **scbpp; int baseB, fcnt, emask, verts; union comboval ocb; - struct ovlp_info vertices[1]; + struct overlap_info vertices[1]; ocb.s = s; baseB = ocb.c.a + ocb.c.b - 1; @@ -719,7 +719,7 @@ makecombo(struct combostr *ocbp, struct spotstr *osp, int off, int s) ncbp->c_voff[1] = off; ncbp->c_vertex = osp - board; ncbp->c_nframes = cbp->c_nframes + 1; - ncbp->c_flg = ocb.c.b ? C_OPEN_1 : 0; + ncbp->c_flags = ocb.c.b ? C_OPEN_1 : 0; ncbp->c_frameindex = ep->e_frameindex; /* * Update the completion spot mask of the frame we @@ -729,7 +729,7 @@ makecombo(struct combostr *ocbp, struct spotstr *osp, int off, int s) ncbp->c_framecnt[0] = ep->e_framecnt; ncbp->c_emask[0] = ep->e_emask; if (verts) { - ncbp->c_flg |= C_LOOP; + ncbp->c_flags |= C_LOOP; ncbp->c_dir = vertices[0].o_frameindex; ncbp->c_framecnt[1] = fcnt - 1; if (ncbp->c_framecnt[1]) { @@ -844,7 +844,7 @@ makeempty(struct combostr *ocbp) nep->e_framecnt = cbp->c_framecnt[0]; nep->e_emask = cbp->c_emask[0]; - if (cbp->c_flg & C_LOOP) { + if (cbp->c_flags & C_LOOP) { s++; /* * Account for the fact that this frame connects @@ -868,7 +868,7 @@ makeempty(struct combostr *ocbp) do { ep--; cbp = ep->e_combo; - if (!(cbp->c_flg & C_LOOP)) + if (!(cbp->c_flags & C_LOOP)) continue; /* @@ -947,10 +947,10 @@ updatecombo(struct combostr *cbp, int color) struct spotstr *sp; struct combostr *tcbp; int i, d; - int nframes, flg, s; + int nframes, flags, s; union comboval cb; - flg = 0; + flags = 0; /* save the top level value for the whole combo */ cb.c.a = cbp->c_combo.c.a; nframes = cbp->c_nframes; @@ -959,7 +959,7 @@ updatecombo(struct combostr *cbp, int color) memset(tmpmap, 0, sizeof(tmpmap)); for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) { - flg = cbp->c_flg; + flags = cbp->c_flags; cb.c.b = cbp->c_combo.c.b; if (color == nextcolor) { /* update the board value for the vertex */ @@ -976,7 +976,7 @@ updatecombo(struct combostr *cbp, int color) /* update the board values for each spot in frame */ sp = &board[s = tcbp->c_vertex]; d = dd[tcbp->c_dir]; - i = (flg & C_OPEN_1) ? 6 : 5; + i = (flags & C_OPEN_1) ? 6 : 5; for (; --i >= 0; sp += d, s += d) { if (sp->s_occ != EMPTY) continue; @@ -993,14 +993,14 @@ updatecombo(struct combostr *cbp, int color) } /* mark the frame as being part of a <1,x> combo */ - board[tcbp->c_vertex].s_flg |= FFLAG << tcbp->c_dir; + board[tcbp->c_vertex].s_flags |= FFLAG << tcbp->c_dir; } if (color != nextcolor) { /* update the board values for each spot in frame */ sp = &board[s = cbp->c_vertex]; d = dd[cbp->c_dir]; - i = (flg & C_OPEN_0) ? 6 : 5; + i = (flags & C_OPEN_0) ? 6 : 5; for (; --i >= 0; sp += d, s += d) { if (sp->s_occ != EMPTY) continue; @@ -1024,7 +1024,7 @@ updatecombo(struct combostr *cbp, int color) } /* mark the frame as being part of a <1,x> combo */ - board[cbp->c_vertex].s_flg |= FFLAG << cbp->c_dir; + board[cbp->c_vertex].s_flags |= FFLAG << cbp->c_dir; } /* @@ -1061,16 +1061,16 @@ appendcombo(struct combostr *cbp, int color __unused) */ int checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp, - int s, struct ovlp_info *vertices) + int s, struct overlap_info *vertices) { struct combostr *tcbp, *lcbp; - int i, n, mask, flg, verts, loop, myindex, fcnt; + int i, n, mask, flags, verts, loop, myindex, fcnt; union comboval cb; u_char *str; short *ip; lcbp = NULL; - flg = 0; + flags = 0; cb.s = s; fcnt = cb.c.a - 2; @@ -1093,8 +1093,8 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp, /* check for intersection of 'tcbp' with 'fcbp' */ myindex--; mask = str[tcbp - frames]; - flg = cbp->c_flg; - n = i + ((flg & C_OPEN_1) != 0); + flags = cbp->c_flags; + n = i + ((flags & C_OPEN_1) != 0); if (mask & (1 << n)) { /* * The two frames are not independent if they @@ -1120,7 +1120,7 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp, * one of the end points if it is an open * ended frame. */ - if ((flg & C_OPEN_1) && + if ((flags & C_OPEN_1) && (n == tcbp->c_vertex || n == tcbp->c_vertex + 5 * dd[tcbp->c_dir])) return (-1); /* invalid overlap */ @@ -1138,7 +1138,7 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp, verts++; } } - n = i + ((flg & C_OPEN_0) != 0); + n = i + ((flags & C_OPEN_0) != 0); } if (cbp == fcbp) return (-1); /* fcbp is already included */ @@ -1170,7 +1170,7 @@ checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp, * one of the end points if it is an open * ended frame. */ - if ((flg & C_OPEN_0) && + if ((flags & C_OPEN_0) && (n == cbp->c_vertex || n == cbp->c_vertex + 5 * dd[cbp->c_dir])) return (-1); /* invalid overlap */ @@ -1318,7 +1318,7 @@ printcombo(struct combostr *cbp, char *str) str += strlen(str); for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) { sprintf(str, " %s%c%x", stoc(tcbp->c_vertex), pdir[tcbp->c_dir], - cbp->c_flg); + cbp->c_flags); str += strlen(str); } sprintf(str, " %s%c", stoc(cbp->c_vertex), pdir[cbp->c_dir]); @@ -1333,7 +1333,7 @@ markcombo(struct combostr *ocbp) struct spotstr *sp; int s, d, m, i; int nframes; - int r, n, flg, cmask, omask; + int r, n, flags, cmask, omask; /* should never happen but check anyway */ if ((nframes = ocbp->c_nframes) >= MAXDEPTH) @@ -1380,7 +1380,7 @@ markcombo(struct combostr *ocbp) nep->e_framecnt = cbp->c_framecnt[0]; nep->e_emask = cbp->c_emask[0]; - if (cbp->c_flg & C_LOOP) { + if (cbp->c_flags & C_LOOP) { s++; /* * Account for the fact that this frame connects @@ -1404,7 +1404,7 @@ markcombo(struct combostr *ocbp) do { ep--; cbp = ep->e_combo; - if (!(cbp->c_flg & C_LOOP)) + if (!(cbp->c_flags & C_LOOP)) continue; /* @@ -1435,7 +1435,7 @@ markcombo(struct combostr *ocbp) omask = (IFLAG | CFLAG) << s; s = ep->e_fval.c.b ? 6 : 5; for (; --s >= 0; sp += d, m >>= 1) - sp->s_flg |= (m & 1) ? omask : cmask; + sp->s_flags |= (m & 1) ? omask : cmask; } } @@ -1447,15 +1447,15 @@ clearcombo(struct combostr *cbp, int open) int d, n, mask; for (; tcbp = cbp->c_link[1]; cbp = cbp->c_link[0]) { - clearcombo(tcbp, cbp->c_flg & C_OPEN_1); - open = cbp->c_flg & C_OPEN_0; + clearcombo(tcbp, cbp->c_flags & C_OPEN_1); + open = cbp->c_flags & C_OPEN_0; } sp = &board[cbp->c_vertex]; d = dd[n = cbp->c_dir]; mask = ~((IFLAG | CFLAG) << n); n = open ? 6 : 5; for (; --n >= 0; sp += d) - sp->s_flg &= mask; + sp->s_flags &= mask; } int -- cgit v1.2.3-56-ge451