- doing_scoring = 0;
- }
-
- /* Calculate the score. */
- if (method == AFTERMATH)
- score = aftermath_compute_score(next, score_tree);
- else
- score = gnugo_estimate_score(NULL, NULL);
-
- if (score < 0.0) {
- sprintf(text, "Black wins by %1.1f points\n", -score);
- winner = 'B';
- }
- else if (score > 0.0) {
- sprintf(text, "White wins by %1.1f points\n", score);
- winner = 'W';
- }
- else {
- sprintf(text, "Jigo\n");
- winner = '0';
- }
- fputs(text, stdout);
- sgftreeAddComment(score_tree, text);
-
- /* For the finish and aftermath methods we compare the score with
+
+ next = gameinfo->to_move;
+ reset_engine();
+
+ /* Complete the game by selfplay for the finish and aftermath methods. */
+ if (method != ESTIMATE) {
+ doing_scoring = 1;
+ while (pass < 2) {
+ move = genmove_conservative(next, &move_value);
+ if (move != PASS_MOVE) {
+ pass = 0;
+ gprintf("%d %s move %1m\n", movenum,
+ next == WHITE ? "white (O)" : "black (X)", move);
+ } else {
+ pass++;
+ gprintf("%d %s move PASS\n", movenum,
+ next == WHITE ? "white (O)" : "black (X)");
+ }
+ play_move(move, next);
+ sgffile_add_debuginfo(score_tree->lastnode, move_value);
+ sgftreeAddPlay(score_tree, next, I(move), J(move));
+ sgffile_output(score_tree);
+ next = OTHER_COLOR(next);
+ }
+ doing_scoring = 0;
+ }
+
+ /* Calculate the score. */
+ if (method == AFTERMATH)
+ score = aftermath_compute_score(next, score_tree);
+ else
+ score = gnugo_estimate_score(NULL, NULL);
+
+ if (score < 0.0) {
+ sprintf(text, "Black wins by %1.1f points\n", -score);
+ winner = 'B';
+ } else if (score > 0.0) {
+ sprintf(text, "White wins by %1.1f points\n", score);
+ winner = 'W';
+ } else {
+ sprintf(text, "Jigo\n");
+ winner = '0';
+ }
+ fputs(text, stdout);
+ sgftreeAddComment(score_tree, text);
+
+ /* For the finish and aftermath methods we compare the score with