gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] score estimation does not work


From: Bertram Felgenhauer
Subject: [gnugo-devel] score estimation does not work
Date: Tue, 29 Mar 2005 21:46:12 +0200
User-agent: Mutt/1.3.28i

Hi,

trying to estimate the score of a game from the command line,

# gnugo --score estimate <sgf file>

results in a segmentation fault.

Analysis: the fault occurs when engine/interface.c::gnugo_estimate_score
(called from interface/play_solo.c::load_and_score_sgf_file with arguments
(NULL, NULL)) tries to store the upper bound result.

Proposed fix:
===========================================================================
diff -u -r1.51 interface.c
--- engine/interface.c  6 Jan 2005 19:50:27 -0000       1.51
+++ engine/interface.c  29 Mar 2005 19:40:43 -0000
@@ -353,8 +353,10 @@
 gnugo_estimate_score(float *upper, float *lower)
 {
   silent_examine_position(EXAMINE_DRAGONS);
-  *upper = white_score;
-  *lower = black_score;
+  if (upper != NULL)
+    *upper = white_score;
+  if (lower != NULL)
+    *lower = black_score;
   return ((white_score + black_score)/2.0);
 }
===========================================================================

As far as I can see, the function is not speed critical and there are a
few other places where it's called with (NULL, NULL) arguments, so checking
the arguments here seems to be the right thing to do. I tested the patch
and it works for me.

With kind regards,

Bertram




reply via email to

[Prev in Thread] Current Thread [Next in Thread]