Ticket #106: optimist-clock.c.patch
| File optimist-clock.c.patch, 1.3 KB (added by alain, 6 years ago) |
|---|
-
./engine/clock.c
old new 38 38 #include "clock.h" 39 39 #include "gg_utils.h" 40 40 #include "board.h" 41 #include <math.h> 41 42 42 43 /* Level data */ 43 44 static int level = DEFAULT_LEVEL; /* current level */ … … 333 334 double time_for_last_move; 334 335 double time_left; 335 336 int stones_left; 337 int stones_left_save; 336 338 337 339 if (!analyze_time_data(color, &time_for_last_move, &time_left, &stones_left)) 338 340 return; 339 341 342 /* Let us be optimistic when we have numerous stones_left to play 343 * ie spend more time in the beginning of the game/byo-yomi, then progressively hurry up */ 340 344 345 stones_left_save=stones_left; 346 if (stones_left_save >= 9) 347 stones_left=pow(0.899,stones_left); 348 /* change nothing for n<9, 15->11, 20->14, 30->21, 60->39, 120->73 */ 349 341 350 /* These rules are both crude and ad hoc. 342 351 * 343 352 * FIXME: Use rules with at least some theoretical basis. … … 366 375 if (level + level_offset > max_level) 367 376 level_offset = max_level - level; 368 377 378 stones_left=stones_left_save; 379 369 380 DEBUG(DEBUG_TIME, "New level %d (%d %C %f %f %d)\n", level + level_offset, 370 381 movenum / 2, color, time_for_last_move, time_left, stones_left); 371 382 }
