gochatai/pachi_py/pachi/timeinfo.c
/* Update time information according to gtp time_left command.
 * kgs doesn't give time_left for the first move, so make sure
 * that just time_settings + time_stop_conditions still work. */
Update time information according to gtp time_left command.
kgs doesn't give time_left for the first move, so make sure
that just time_settings + time_stop_conditions still work.
Update time information according to gtp time_left command . kgs doesn ' t give time_left for the first move so make sure that just time_settings + time_stop_conditions still work .
void
time_left(struct time_info *ti, int time_left, int stones_left)
{
	assert(ti->period != TT_NULL);
	ti->dim = TD_WALLTIME;
	if (!time_left && !stones_left) {
		ti->period = TT_MOVE;
		ti->len.t.main_time = 0;
		ti->len.t.byoyomi_time = ti->len.t.byoyomi_time_max;
		ti->len.t.byoyomi_stones = ti->len.t.byoyomi_stones_max;
	} else if (!stones_left) {
		ti->period = TT_TOTAL;
		ti->len.t.main_time = time_left;
		ti->len.t.byoyomi_time = ti->len.t.byoyomi_time_max;
		ti->len.t.byoyomi_stones = ti->len.t.byoyomi_stones_max;
	} else {
		ti->period = TT_MOVE;
		ti->len.t.main_time = 0;
		ti->len.t.byoyomi_time = time_left;
		if (ti->len.t.canadian) {
			ti->len.t.byoyomi_stones = stones_left;
		} else {
			ti->len.t.byoyomi_periods = stones_left;
		}
	}
}
void time_left ( struct time_info * ti , int time_left , int stones_left ) { assert ( ti -> period != TT_NULL ) ; ti -> dim = TD_WALLTIME ; if ( ! time_left && ! stones_left ) { ti -> period = TT_MOVE ; ti -> len . t . main_time = 0 ; ti -> len . t . byoyomi_time = ti -> len . t . byoyomi_time_max ; ti -> len . t . byoyomi_stones = ti -> len . t . byoyomi_stones_max ; } else if ( ! stones_left ) { ti -> period = TT_TOTAL ; ti -> len . t . main_time = time_left ; ti -> len . t . byoyomi_time = ti -> len . t . byoyomi_time_max ; ti -> len . t . byoyomi_stones = ti -> len . t . byoyomi_stones_max ; } else { ti -> period = TT_MOVE ; ti -> len . t . main_time = 0 ; ti -> len . t . byoyomi_time = time_left ; if ( ti -> len . t . canadian ) { ti -> len . t . byoyomi_stones = stones_left ; } else { ti -> len . t . byoyomi_periods = stones_left ; } } }
Update time information according to gtp time_left command.
Update time information according to gtp time_left command .
/* Some GTP peers send time_left 0 0 at the end of main time. */ /* Main time */ /* Byoyomi */ // field misused by kgs