RCS file: /cvsroot/gnugo/gnugo/engine/clock.c,v
retrieving revision 1.24
diff -u -p -r1.24 clock.c
|
|
|
clock_print(int color) |
| 124 | 124 | /* |
| 125 | 125 | * Initialize the time settings for this game. |
| 126 | 126 | * -1 means "do not modify this value". |
| | 127 | * |
| | 128 | * byo_time > 0 and byo_stones == 0 means no time settings. |
| 127 | 129 | */ |
| 128 | 130 | void |
| 129 | 131 | clock_settings(int time, int byo_time, int byo_stones) |
| … |
… |
clock_settings(int time, int byo_time, i |
| 141 | 143 | * 0 otherwise. |
| 142 | 144 | */ |
| 143 | 145 | int |
| 144 | | get_clock_settings(int *t, int *byo_t, int *byo_s) |
| | 146 | have_time_settings(void) |
| 145 | 147 | { |
| 146 | | if (t) |
| 147 | | *t = main_time; |
| 148 | | if (byo_t) |
| 149 | | *byo_t = byoyomi_time; |
| 150 | | if (byo_s) |
| 151 | | *byo_s = byoyomi_stones; |
| 152 | | return (main_time >= 0 || byoyomi_time >= 0); |
| | 148 | /* According to the semantics of the GTP command 'time_settings', the |
| | 149 | * following signifies no time limits. |
| | 150 | */ |
| | 151 | if (byoyomi_time > 0 && byoyomi_stones == 0) |
| | 152 | return 0; |
| | 153 | else |
| | 154 | return (main_time >= 0 || byoyomi_time >= 0); |
| 153 | 155 | } |
| 154 | 156 | |
| 155 | 157 | |
| … |
… |
update_time_left(int color, int time_lef |
| 182 | 184 | = ((color == BLACK) ? &black_time_data : &white_time_data); |
| 183 | 185 | int time_used = td->official.time_left - time_left; |
| 184 | 186 | |
| | 187 | if (time_left > 0) |
| | 188 | td->time_out = 0; |
| | 189 | else |
| | 190 | td->time_out = 1; |
| | 191 | |
| 185 | 192 | /* Did our estimate for time usage go wrong? */ |
| 186 | 193 | if (time_used > 0 |
| 187 | 194 | && gg_abs(time_used - td->estimated.time_for_last_move) >= 1.0) |
| … |
… |
update_time_left(int color, int time_lef |
| 193 | 200 | td->estimated.time_left = time_left; |
| 194 | 201 | if (stones > 0) |
| 195 | 202 | td->estimated.in_byoyomi = 1; |
| | 203 | else |
| | 204 | td->estimated.in_byoyomi = 0; |
| 196 | 205 | |
| 197 | 206 | td->official.stones = stones; |
| 198 | 207 | td->official.movenum = movenum; |
| … |
… |
clock_push_button(int color) |
| 213 | 222 | = (color == BLACK) ? &black_time_data : &white_time_data; |
| 214 | 223 | double now = gg_gettimeofday(); |
| 215 | 224 | |
| | 225 | if (!have_time_settings()) |
| | 226 | return; |
| | 227 | |
| 216 | 228 | if (last_movenum >= 0 |
| 217 | 229 | && movenum == last_movenum + 1 |
| 218 | 230 | && movenum > td->estimated.movenum) { |
| … |
… |
analyze_time_data(int color, double *tim |
| 274 | 286 | : &white_time_data.estimated; |
| 275 | 287 | |
| 276 | 288 | /* Do we have any time limits. */ |
| 277 | | if (!get_clock_settings(NULL, NULL, NULL)) |
| | 289 | if (!have_time_settings()) |
| 278 | 290 | return 0; |
| 279 | 291 | |
| 280 | 292 | /* If we don't have consistent time information yet, just return. */ |
RCS file: /cvsroot/gnugo/gnugo/engine/clock.h,v
retrieving revision 1.12
diff -u -p -r1.12 clock.h
|
|
|
|
| 26 | 26 | #include "gnugo.h" |
| 27 | 27 | |
| 28 | 28 | /* initialization and activation */ |
| 29 | | void clock_settings(int time, int byo_time, int byo_stones); |
| | 29 | void clock_settings(int maintyime, int byotime, int byostones); |
| 30 | 30 | void init_timers(void); |
| 31 | 31 | |
| 32 | 32 | /* main access */ |
| 33 | 33 | void clock_push_button(int color); |
| 34 | 34 | void update_time_left(int color, int time_left, int stones); |
| 35 | 35 | void clock_print(int color); |
| 36 | | int get_clock_settings(int *t, int *byo_t, int *byo_s); |
| | 36 | int have_time_settings(void); |
| 37 | 37 | |
| 38 | 38 | void adjust_level_offset(int color); |
| 39 | 39 | |
RCS file: /cvsroot/gnugo/gnugo/interface/play_ascii.c,v
retrieving revision 1.63
diff -u -p -r1.63 play_ascii.c
|
|
|
do_play_ascii(Gameinfo *gameinfo) |
| 627 | 627 | char *tmpstring; |
| 628 | 628 | int state = 1; |
| 629 | 629 | |
| 630 | | if (get_clock_settings(NULL, NULL, NULL)) |
| | 630 | if (have_time_settings()) |
| 631 | 631 | clock_on = 1; |
| 632 | 632 | |
| 633 | 633 | while (state == 1) { |