[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] arend_3_2.3: Reinstate lexicographical order in move valua
From: |
Arend Bayer |
Subject: |
[gnugo-devel] arend_3_2.3: Reinstate lexicographical order in move valuation trace |
Date: |
Thu, 2 May 2002 14:54:05 +0200 (CEST) |
There is a patch by Gunnar in CVS that makes the board loops in
value_moves.c one-dimensional. This is of course better style, but the
loop in the function value_moves should be left as it is to keep the
trace output of the move valuations in lexicographical order.
Arend
- restore lexicographical order of board loop in function value_moves
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.32
diff -u -r1.32 value_moves.c
--- engine/value_moves.c 29 Apr 2002 20:50:42 -0000 1.32
+++ engine/value_moves.c 2 May 2002 12:53:25 -0000
@@ -2504,34 +2504,35 @@
static void
value_moves(int color, float pure_threat_value, float score)
{
+ int m, n;
int pos;
TRACE("\nMove valuation:\n");
/* Visit the moves in the standard lexicographical order */
- for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
- if (!ON_BOARD(pos))
- continue;
+ for (n = 0; n < board_size; n++)
+ for (m = board_size-1; m >= 0; m--) {
+ pos = POS(m, n);
- move[pos].value = value_move_reasons(pos, color,
- pure_threat_value, score);
- if (move[pos].value == 0.0)
- continue;
-
- /* Maybe this test should be performed elsewhere. This is just
- * to get some extra safety. We don't filter out illegal ko
- * captures here though, because if that is the best move, we
- * should reevaluate ko threats.
- */
- if (is_legal(pos, color) || is_illegal_ko_capture(pos, color)) {
- /* Add a random number between 0 and 0.01 to use in comparisons. */
- move[pos].value += 0.01 * move[pos].random_number;
+ move[pos].value = value_move_reasons(pos, color,
+ pure_threat_value, score);
+ if (move[pos].value == 0.0)
+ continue;
+
+ /* Maybe this test should be performed elsewhere. This is just
+ * to get some extra safety. We don't filter out illegal ko
+ * captures here though, because if that is the best move, we
+ * should reevaluate ko threats.
+ */
+ if (is_legal(pos, color) || is_illegal_ko_capture(pos, color)) {
+ /* Add a random number between 0 and 0.01 to use in comparisons. */
+ move[pos].value += 0.01 * move[pos].random_number;
+ }
+ else {
+ move[pos].value = 0.0;
+ TRACE("Move at %1m wasn't legal.\n", pos);
+ }
}
- else {
- move[pos].value = 0.0;
- TRACE("Move at %1m wasn't legal.\n", pos);
- }
- }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] arend_3_2.3: Reinstate lexicographical order in move valuation trace,
Arend Bayer <=