Module Name: src Committed By: rillig Date: Sat May 21 10:01:49 UTC 2022
Modified Files: src/games/gomoku: pickmove.c Log Message: gomoku: prevent thinking for too long At search depth 9, picking a move takes about a minute on modern hardware, which is enough for casual game play. Even then, gomoku does not always find the perfect move, so investing that much time seems questionable. Limiting the search depth also puts an upper bound on the memory usage, which is quite high with 150 MB. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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/pickmove.c diff -u src/games/gomoku/pickmove.c:1.39 src/games/gomoku/pickmove.c:1.40 --- src/games/gomoku/pickmove.c:1.39 Fri May 20 19:30:17 2022 +++ src/games/gomoku/pickmove.c Sat May 21 10:01:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.39 2022/05/20 19:30:17 rillig Exp $ */ +/* $NetBSD: pickmove.c,v 1.40 2022/05/21 10:01:49 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.39 2022/05/20 19:30:17 rillig Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.40 2022/05/21 10:01:49 rillig Exp $"); #include <stdlib.h> #include <string.h> @@ -332,6 +332,8 @@ scanframes(int color) d = 2; /* LINTED 117: bitwise '>>' on signed value possibly nonportable */ while (d <= ((movenum + 1) >> 1) && combolen > n) { + if (d >= 9) + break; /* Do not think too long. */ if (debug != 0) { debuglog("%cL%d %d %d %d", "BW"[color], d, combolen - n, combocnt, elistcnt);