Module Name:    src
Committed By:   rillig
Date:           Sun May 22 10:45:02 UTC 2022

Modified Files:
        src/games/gomoku: gomoku.h pickmove.c

Log Message:
gomoku: document a missed immediate win

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/games/gomoku/gomoku.h
cvs rdiff -u -r1.42 -r1.43 src/games/gomoku/pickmove.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/gomoku/gomoku.h
diff -u src/games/gomoku/gomoku.h:1.38 src/games/gomoku/gomoku.h:1.39
--- src/games/gomoku/gomoku.h:1.38	Sat May 21 17:19:10 2022
+++ src/games/gomoku/gomoku.h	Sun May 22 10:45:02 2022
@@ -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 @@ union comboval {
 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 */

Index: src/games/gomoku/pickmove.c
diff -u src/games/gomoku/pickmove.c:1.42 src/games/gomoku/pickmove.c:1.43
--- src/games/gomoku/pickmove.c:1.42	Sat May 21 16:39:14 2022
+++ src/games/gomoku/pickmove.c	Sun May 22 10:45:02 2022
@@ -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 @@ scanframes(int color)
 		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) {

Reply via email to