gochatai/pachi_py/pachi/timeinfo.c
/* Adjust the recommended per-move time based on the current game phase.
 * We expect stop->worst to be total time available, stop->desired the current
 * per-move time allocation, and set stop->desired to adjusted per-move time. */
Adjust the recommended per-move time based on the current game phase.
Adjust the recommended per - move time based on the current game phase .
static void
time_stop_phase_adjust(struct board *b, int fuseki_end, int yose_start, struct time_stop *stop)
{
	int bsize = (board_size(b)-2)*(board_size(b)-2);
	fuseki_end = fuseki_end * bsize / 100; 
	yose_start = yose_start * bsize / 100; 
	assert(fuseki_end < yose_start);
	if (b->moves >= yose_start)
		return;
	int moves_to_yose = (yose_start - b->moves) / 2;
	int left_at_yose_start = board_estimated_moves_left(b) - moves_to_yose;
	if (left_at_yose_start < MIN_MOVES_LEFT)
		left_at_yose_start = MIN_MOVES_LEFT;
	double middlegame_time = stop->worst.time / left_at_yose_start;
	if (middlegame_time < stop->desired.time)
		return;
	if (b->moves < fuseki_end) {
		assert(fuseki_end > 0);
		double beta = b->moves / fuseki_end;
		stop->desired.time = middlegame_time * beta + stop->desired.time * (1 - beta);
	} else { assert(b->moves < yose_start);
		stop->desired.time = middlegame_time;
	}
}
static void time_stop_phase_adjust ( struct board * b , int fuseki_end , int yose_start , struct time_stop * stop ) { int bsize = ( board_size ( b ) - 2 ) * ( board_size ( b ) - 2 ) ; fuseki_end = fuseki_end * bsize / 100 ; yose_start = yose_start * bsize / 100 ; assert ( fuseki_end < yose_start ) ; if ( b -> moves >= yose_start ) return ; int moves_to_yose = ( yose_start - b -> moves ) / 2 ; int left_at_yose_start = board_estimated_moves_left ( b ) - moves_to_yose ; if ( left_at_yose_start < MIN_MOVES_LEFT ) left_at_yose_start = MIN_MOVES_LEFT ; double middlegame_time = stop -> worst . time / left_at_yose_start ; if ( middlegame_time < stop -> desired . time ) return ; if ( b -> moves < fuseki_end ) { assert ( fuseki_end > 0 ) ; double beta = b -> moves / fuseki_end ; stop -> desired . time = middlegame_time * beta + stop -> desired . time * ( 1 - beta ) ; } else { assert ( b -> moves < yose_start ) ; stop -> desired . time = middlegame_time ; } }
Adjust the recommended per-move time based on the current game phase.
Adjust the recommended per - move time based on the current game phase .
// move nb at fuseki end // move nb at yose start /* No adjustments in yose. */ // ^- /2 because we only consider the moves we have to play ourselves /* This particular value of middlegame_time will continuously converge
	 * to effective "yose_time" value as we approach yose_start. */ /* At the game start, use stop->desired.time (rather
		 * conservative estimate), then gradually prolong it. */ /* Middlegame, start with relatively large value, then
		 * converge to the uniform-timeslice yose value. */