Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/gomoku gomoku: document a missed immediate win



details:   https://anonhg.NetBSD.org/src/rev/2f2db50da923
branches:  trunk
changeset: 366306:2f2db50da923
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun May 22 10:45:02 2022 +0000

description:
gomoku: document a missed immediate win

No binary change.

diffstat:

 games/gomoku/gomoku.h   |  27 ++++++++++++++++-----------
 games/gomoku/pickmove.c |   9 +++++++--
 2 files changed, 23 insertions(+), 13 deletions(-)

diffs (73 lines):

diff -r 73d37fb01782 -r 2f2db50da923 games/gomoku/gomoku.h
--- a/games/gomoku/gomoku.h     Sun May 22 09:57:58 2022 +0000
+++ b/games/gomoku/gomoku.h     Sun May 22 10:45:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gomoku.h,v 1.38 2022/05/21 17:19:10 rillig Exp $       */
+/*     $NetBSD: gomoku.h,v 1.39 2022/05/22 10:45:02 rillig Exp $       */
 
 /*
  * Copyright (c) 1994
@@ -151,18 +151,23 @@
 struct combostr {
        struct combostr *c_next;        /* list of combos at the same level */
        struct combostr *c_prev;        /* list of combos at the same level */
-       struct combostr *c_link[2];     /* C:previous level or F:NULL */
-       union comboval  c_linkv[2];     /* C:combo value for link[0,1] */
-       union comboval  c_combo;        /* C:combo value for this level */
-       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_flags;        /* C:combo flags */
-       u_char          c_frameindex;   /* C:intersection frame index */
+       struct combostr *c_link[2];     /* F: NULL,
+                                        * C: previous level */
+       union comboval  c_linkv[2];     /* C: combo value for link[0, 1] */
+       union comboval  c_combo;        /* F: initial combo value (read-only),
+                                        * C: combo value for this level */
+       u_short         c_vertex;       /* F: frame head,
+                                        * C: intersection */
+       u_char          c_nframes;      /* F: 1,
+                                        * C: number of frames in the combo */
+       u_char          c_dir;          /* F: frame direction,
+                                        * C: loop frame */
+       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
+       u_char          c_emask[2];     /* C: bit mask of completion spots for
                                         * link[0] and link[1] */
-       u_char          c_voff[2];      /* C:vertex offset within frame */
+       u_char          c_voff[2];      /* C: vertex offset within frame */
 };
 
 /* flag values for c_flags */
diff -r 73d37fb01782 -r 2f2db50da923 games/gomoku/pickmove.c
--- a/games/gomoku/pickmove.c   Sun May 22 09:57:58 2022 +0000
+++ b/games/gomoku/pickmove.c   Sun May 22 10:45:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pickmove.c,v 1.42 2022/05/21 16:39:14 rillig Exp $     */
+/*     $NetBSD: pickmove.c,v 1.43 2022/05/22 10:45:02 rillig Exp $     */
 
 /*
  * Copyright (c) 1994
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 /*     @(#)pickmove.c  8.2 (Berkeley) 5/3/95   */
-__RCSID("$NetBSD: pickmove.c,v 1.42 2022/05/21 16:39:14 rillig Exp $");
+__RCSID("$NetBSD: pickmove.c,v 1.43 2022/05/22 10:45:02 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -243,6 +243,11 @@
                return;
 
        /* quick check for four in a row */
+       /*
+        * TODO: This quick check misses that after loading the game K10 J9
+        *  M10 J10 O10 J11 Q10 J8 and playing K9, there are 2 immediate
+        *  winning moves J12 and J7.
+        */
        sp = &board[cbp->c_vertex];
        cb.s = sp->s_fval[color][d = cbp->c_dir].s;
        if (cb.s < 0x101) {



Home | Main Index | Thread Index | Old Index