[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] gmp mode sgf output
From: |
Paul Pogonyshev |
Subject: |
[gnugo-devel] gmp mode sgf output |
Date: |
Mon, 2 Sep 2002 22:32:06 +0300 |
this patch is an addition to sgf_3_7.1a. it makes gnu go output sgf
files using trees in gmp mode also.
*current issues*:
for some reason it handles passes coming from gmp client incorrectly
(at least on 19x19 board). however, the same is true for 3.3.5. it
may be a bug in jago 4.42 which i used for testing.
please, test with other clients.
if mistake is not jago-specific, it is gmp.c which should be fixed.
lines 414-418:
s = val & 0x1ff;
if (s == 0) {
x = -1;
y = 0;
} else if (s == 0x1ff) {
when pass is coming from jago, val=342 (19x19 board). gmp.c expects
that val=0 is sent for passes.
Index: interface/play_gmp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gmp.c,v
retrieving revision 1.9
diff -u -r1.9 play_gmp.c
--- interface/play_gmp.c 7 Mar 2002 05:35:28 -0000 1.9
+++ interface/play_gmp.c 2 Sep 2002 19:22:00 -0000
@@ -118,7 +118,7 @@
}
gameinfo->computer_player = mycolor;
- sgffile_write_gameinfo(gameinfo, "gmp");
+ sgf_write_header(sgftree.root, 1, random_seed, gnugo_get_komi(), level,
chinese_rules);
gameinfo->handicap = gnugo_sethand(gameinfo->handicap, sgftree.root);
sgfOverwritePropertyInt(sgftree.root, "HA", gameinfo->handicap);
@@ -132,7 +132,8 @@
if (message == gmp_err) {
fprintf(stderr, "GNU Go: Sorry, error from gmp client\n");
- sgffile_close_file();
+ sgfAddComment(curnode, "got error from gmp client");
+ sgffile_output(sgftree.root);
return;
}
@@ -146,7 +147,7 @@
j - k);
break;
}
- sgffile_write_comment("undo");
+ sgfAddComment(curnode, "undone");
curnode = curnode->parent;
to_move = OTHER_COLOR(to_move);
}
@@ -157,7 +158,7 @@
++passes;
curnode = sgfAddPlay(curnode, to_move, -1, -1);
gnugo_play_move(-1, -1, yourcolor);
- sgffile_move_made(-1, -1, to_move, moveval);
+ sgffile_output(sgftree.root);
}
else {
/* not pass */
@@ -165,7 +166,7 @@
curnode = sgfAddPlay(curnode, to_move, i, j);
TRACE("\nyour move: %m\n\n", i, j);
gnugo_play_move(i, j, yourcolor);
- sgffile_move_made(i, j, to_move, moveval);
+ sgffile_output(sgftree.root);
}
}
@@ -173,22 +174,23 @@
/* Generate my next move. */
moveval = gnugo_genmove(&i, &j, mycolor);
gnugo_play_move(i, j, mycolor);
+ sgffile_debuginfo(curnode, moveval);
if (moveval < 0) {
/* pass */
curnode = sgfAddPlay(curnode, to_move, -1, -1);
gmp_sendPass(ge);
- sgffile_move_made(-1, -1, to_move, moveval);
++passes;
}
else {
/* not pass */
curnode = sgfAddPlay(curnode, to_move, i, j);
gmp_sendMove(ge, j, i);
- sgffile_move_made(i, j, to_move, moveval);
passes = 0;
TRACE("\nmy move: %m\n\n", i, j);
}
+ sgffile_debuginfo(curnode, 0);
+ sgffile_output(sgftree.root);
}
to_move = OTHER_COLOR(to_move);
@@ -203,7 +205,6 @@
if (!quiet)
fprintf(stderr, "Game over - waiting for client to shut us down\n");
- sgffile_close_file();
who_wins(mycolor, stderr);
@@ -213,6 +214,7 @@
score = gnugo_estimate_score(&lower_bound, &upper_bound);
sgfWriteResult(sgftree.root, score, 1);
+ sgffile_output(sgftree.root);
while (!time_to_die) {
message = gmp_check(ge, 1, &j, &i, &error);
- [gnugo-devel] gmp mode sgf output,
Paul Pogonyshev <=