[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] snapback in readconnect.c
From: |
Teun Burgers |
Subject: |
[gnugo-devel] snapback in readconnect.c |
Date: |
Fri, 02 Nov 2001 19:44:22 +0100 |
It looks to me the snapback function in readconnect.c
uses only the first liberty. So we only need to fetch
one liberty from findlib instead of up to MAXLIBS.
Or am I missing something?
Teun
Index: readconnect.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/readconnect.c,v
retrieving revision 1.9
diff -u -r1.9 readconnect.c
--- readconnect.c 2001/10/28 13:53:25 1.9
+++ readconnect.c 2001/11/02 18:42:35
@@ -97,7 +97,7 @@
/* verifies that capturing the stone at str is not a snapback */
static int snapback (int str) {
- int stones, liberties, libs[MAXLIBS];
+ int stones, liberties, lib;
/* if more than one stone captured, not a snapback */
stones = countstones(str);
@@ -105,16 +105,16 @@
return 0;
/* if more than one liberty, not a snapback */
- liberties = findlib(str, MAXLIBS, libs);
+ liberties = findlib(str, 1, &lib);
if (liberties > 1)
return 0;
/* if only one liberty after capture */
- if (trymove(libs[0], OTHER_COLOR(board[str]),
+ if (trymove(lib, OTHER_COLOR(board[str]),
"snapback", str, EMPTY, 0)) {
- liberties=0;
- if (IS_STONE(board[libs[0]]))
- liberties = countlib(libs[0]);
+ liberties = 0;
+ if (IS_STONE(board[lib]))
+ liberties = countlib(lib);
popgo();
if (liberties > 1)
return 0;
- [gnugo-devel] snapback in readconnect.c,
Teun Burgers <=