Ticket #33 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Unify level adaption systems in clock.c and play_gtp.c

Reported by: arend Owned by: arend
Priority: normal Milestone: 3.7.8
Component: source Version:
Severity: normal Keywords:
Cc: patch: yes

Description (last modified by arend) (diff)

Currently we have two level adaption schemese:
* In clock.c, triggered by --autolevel
* In play_gtp.c, triggered by time_left GTP commands.

This patch unifies them. While it reuses some of the clock measurement code of clock.c, for the actual level adaption system it uses the logic of the code of play_gtp.c, which (while somewhat simplistic) has been tested in some thousands of KGS games.

With the new code, clock.c automatically tracks time usage for both colors (triggered by clock_push_button() in gnugo_genmove()). This timing data can be overwritten by calls to update_time_left() (e.g. called upon the GTP command time_left). However, the interface explicitly has to call adjust_level_offset() for this to have any effect.

The variables level, min_level, max_level and level_offset are now privat variables of clock.c, accessible via set_level() etc. level_offset is not accessible directly, it is set by adjust_level_offset(); however, get_level() always returns level + level_offset.

Attachments

arend_7_8.1-clock.diff Download (49.2 KB) - added by arend 5 years ago.
Rework of clock.c
arend_7_8.1b-clock.diff Download (50.5 KB) - added by arend 5 years ago.
revised patch
arend_7_8.1c.diff Download (3.7 KB) - added by arend 5 years ago.
Fixes some buglets caused by arend_7_8.1b, most notably causing a violation of the GTP time_settings command.

Regression Results

Attachment Rev. PASS FAIL Nodes Status
arend_7_8.1-clock.diff Download never tested
arend_7_8.1b-clock.diff Download never tested
arend_7_8.1c.diff Download never tested

Change History

Changed 5 years ago by arend

  • description modified (diff)

Changed 5 years ago by arend

  • description modified (diff)

Changed 5 years ago by arend

Rework of clock.c

Changed 5 years ago by arend

  • description modified (diff)

Changed 5 years ago by gunnar

Comments on the patch (arend_7_8.1-clock.diff):

+  if (1) {
+    /*if (level_offset != 0) { */
+      gprintf("New level %d (%d %C %f %f %d)\n", level + level_offset,
+             movenum / 2, color, time_for_last_move, time_left, stones_left);
+    /*}*/

That outcommenting doesn't look good. By the way I think it would be good to introduce a DEBUG_TIME or similar for time and level information.

@@ -3042,10 +2894,7 @@ gtp_time_settings(char *s)
   if (sscanf(s, "%d %d %d", &a, &b, &c) < 3)
     return gtp_failure("not three integers");
 
-  main_time = a;
-  byo_yomi_time = b;
-  byo_yomi_stones = c;
-
+  clock_settings(a, b, c);
   return gtp_success("");
 }

Now that main_time, byo_yomi_time, and byo_yomi_stones no longer are file static variables, it would be better to use those names in place of a, b, and c.

--- interface/gtp_examples/twogtp.pike  12 Jun 2005 09:34:14 -0000      1.13
+++ interface/gtp_examples/twogtp.pike  9 Oct 2005 22:47:47 -0000
@@ -377,8 +377,8 @@ class GtpServer {
 
     if (use_time_control) {
       if (main_time >= 0.0) {
-       send_command(sprintf("time_left %s %d %d", color,
-                            (int) time_left, stones_left));
+/*     send_command(sprintf("time_left %s %d %d", color,
+                            (int) time_left, stones_left)); */

Why this removal?

Changed 5 years ago by arend

revised patch

Changed 5 years ago by arend

The revised patch arend_7_8.1b fixes the issues mentioned by Gunnar, and revives the clock printing in ASCII playing mode. Also, it introduces a new debug flag DEBUG_TIME, which causes to log clock standing and level adaption decisions.

Changed 5 years ago by gunnar

Minor typo (leven) in the patch:

+int autolevel_on      = 0;  /* Adjust leven in GMP or ASCII mode. */

Changed 5 years ago by arend

  • status changed from new to closed
  • resolution set to fixed

Changed 5 years ago by arend

Fixes some buglets caused by arend_7_8.1b, most notably causing a violation of the GTP time_settings command.

Changed 5 years ago by arend

  • status changed from closed to reopened
  • resolution fixed deleted

The patch ignored the way the GTP time_settings command indicated games with no time limits. This caused weird behaviour on KGS. This is fixed by arend_7_8.1c.diff.

Changed 5 years ago by arend

  • owner changed from gnugo to arend
  • status changed from reopened to new

Changed 5 years ago by gunnar

Is anything still missing before this ticket can be closed?

Changed 5 years ago by arend

The remaing issues were fixed when arend_7_8.1c was applied.

Changed 5 years ago by arend

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.