[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] order_moves and moves->message
From: |
Arend Bayer |
Subject: |
[gnugo-devel] order_moves and moves->message |
Date: |
Tue, 29 Apr 2003 12:14:55 +0200 (CEST) |
Hmm, the new sgf message scheme didn't quite get respected by
order_moves()...
Also, I took the opportunity to add FIXME in attack2().
Arend
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.112
diff -u -p -r1.112 reading.c
--- engine/reading.c 22 Apr 2003 15:44:44 -0000 1.112
+++ engine/reading.c 29 Apr 2003 10:16:33 -0000
@@ -3324,6 +3324,11 @@ attack2(int str, int *move, int komaster
/* FIXME: If there is more than one neighbor in atari, we
* currently just take one randomly. This is maybe not good
* enough. We might also want to check against snapback.
+ *
+ * FIXME: What is the purpose of this? It produces some
+ * completely irrelevant moves (e.g. if bpos is a huge string
+ * with many liberties and adjs[0] is somewhere else on the
+ * board).
*/
findlib(adjs[0], 1, &xpos);
ADD_CANDIDATE_MOVE(xpos, 0, moves, "back-capture");
@@ -5006,8 +5011,6 @@ order_moves(int str, struct reading_move
int string_libs = countlib(str);
int r;
int i, j;
- int maxscore;
- int max_at;
/* don't bother sorting if only one move, or none at all */
if (moves->num - first_move < 2)
@@ -5173,10 +5176,10 @@ order_moves(int str, struct reading_move
* selection sort.
*/
for (i = first_move; i < moves->num-1; i++) {
+ int maxscore = moves->score[i];
+ int max_at = 0; /* This is slightly faster than max_at = i. */
/* Find the move with the biggest score. */
- maxscore = moves->score[i];
- max_at = 0; /* This is slightly faster than max_at = i. */
for (j = i + 1; j < moves->num; j++) {
if (moves->score[j] > maxscore) {
maxscore = moves->score[j];
@@ -5190,12 +5193,15 @@ order_moves(int str, struct reading_move
if (max_at != 0) {
int temp = moves->pos[max_at];
+ const char *temp_message = moves->message[max_at];
moves->pos[max_at] = moves->pos[i];
moves->score[max_at] = moves->score[i];
+ moves->message[max_at] = moves->message[i];
moves->pos[i] = temp;
moves->score[i] = maxscore;
+ moves->message[i] = temp_message;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] order_moves and moves->message,
Arend Bayer <=