[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] Patch: improve separation of similarly-valued moves
From: |
Evan Daniel |
Subject: |
Re: [gnugo-devel] Patch: improve separation of similarly-valued moves |
Date: |
Tue, 20 Apr 2004 13:57:44 -0400 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040306) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Arend Bayer wrote:
| Sorry if I start sounding repetitive, but please add comments.
I suppose I'm guilty of that too. Here's an updated patch.
- - new GTP function move_uncertainty
Evan Daniel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAhWSY0OcbTJFOafIRAlLRAJ9oSeLypOsWgCVzuFhR6Q63SYYQPQCfU6gT
S/534opwpkd/9lkqYcd9Bmo=
=1964
-----END PGP SIGNATURE-----
diff -u interface/play_gtp.c interface/play_gtp.c
--- interface/play_gtp.c 20 Apr 2004 15:34:30 -0000
+++ interface/play_gtp.c 20 Apr 2004 17:55:46 -0000
@@ -26,6 +26,7 @@
#include <assert.h>
#include <ctype.h>
#include <string.h>
+#include <math.h>
#include "interface.h"
#include "liberty.h"
@@ -136,6 +137,7 @@
DECLARE(gtp_move_influence);
DECLARE(gtp_move_probabilities);
DECLARE(gtp_move_reasons);
+DECLARE(gtp_move_uncertainty);
DECLARE(gtp_name);
DECLARE(gtp_owl_attack);
DECLARE(gtp_owl_connection_defends);
@@ -275,6 +277,7 @@
{"move_influence", gtp_move_influence},
{"move_probabilities", gtp_move_probabilities},
{"move_reasons", gtp_move_reasons},
+ {"move_uncertainty", gtp_move_uncertainty},
{"name", gtp_name},
{"new_score", gtp_estimate_score},
{"orientation", gtp_set_orientation},
@@ -3765,0 +3769,30 @@
+/* Function: Return the number of bits of uncertainty in the move.
+ * Arguments: none
+ * Fails: never
+ * Returns: bits of uncertainty
+ */
+static int
+gtp_move_uncertainty(char *s)
+{
+ float probabilities[BOARDMAX];
+ int pos;
+ float uncertainty = 0.0;
+
+ UNUSED(s);
+
+ compute_move_probabilities(probabilities);
+
+ gtp_start_response(GTP_SUCCESS);
+ for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
+ if (ON_BOARD(pos) && probabilities[pos] > 0.0) {
+ /* Shannon's formula */
+ uncertainty += -1 * probabilities[pos] * log2f(probabilities[pos]);
+ }
+ }
+
+ gtp_printf("%.4f\n\n", uncertainty);
+
+ return GTP_OK;
+}
+
+
- [gnugo-devel] Patch: improve separation of similarly-valued moves, Inge Wallin, 2004/04/14
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Evan Daniel, 2004/04/14
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Arend Bayer, 2004/04/18
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Paul Pogonyshev, 2004/04/20
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Arend Bayer, 2004/04/20
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Paul Pogonyshev, 2004/04/20
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Paul Pogonyshev, 2004/04/20
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves,
Evan Daniel <=
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Evan Daniel, 2004/04/20
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Paul Pogonyshev, 2004/04/21
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Gunnar Farnebäck, 2004/04/21
- Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Evan Daniel, 2004/04/21
Re: [gnugo-devel] Patch: improve separation of similarly-valued moves, Gunnar Farneback, 2004/04/14