Ticket #33 (closed enhancement: fixed)
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
Regression Results
| Attachment | Rev. | PASS | FAIL | Nodes | Status | |
| arend_7_8.1-clock.diff | never tested | |||||
| arend_7_8.1b-clock.diff | never tested | |||||
| arend_7_8.1c.diff | never tested |
Change History
comment:4 Changed 6 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?
comment:5 Changed 6 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.
comment:6 Changed 6 years ago by gunnar
Minor typo (leven) in the patch:
+int autolevel_on = 0; /* Adjust leven in GMP or ASCII mode. */
Changed 6 years ago by arend
-
attachment
arend_7_8.1c.diff
added
Fixes some buglets caused by arend_7_8.1b, most notably causing a violation of the GTP time_settings command.
comment:8 Changed 6 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.
comment:9 Changed 6 years ago by arend
- Owner changed from gnugo to arend
- Status changed from reopened to new
comment:10 Changed 6 years ago by gunnar
Is anything still missing before this ticket can be closed?
comment:11 Changed 6 years ago by arend
The remaing issues were fixed when arend_7_8.1c was applied.
