gochatai/pachi_py/pachi/timeinfo.c
/* Update time settings according to gtp time_settings or kgs-time_settings command. */
Update time settings according to gtp time_settings or kgs-time_settings command.
Update time settings according to gtp time_settings or kgs - time_settings command .
void
time_settings(struct time_info *ti, int main_time, int byoyomi_time, int byoyomi_stones, int byoyomi_periods)
{
	if (main_time < 0) {
		ti->period = TT_NULL; 
	} else {
		ti->period = main_time > 0 ? TT_TOTAL : TT_MOVE;
		ti->dim = TD_WALLTIME;
		ti->len.t.timer_start = 0;
		ti->len.t.main_time = (double) main_time;
		ti->len.t.byoyomi_time = (double) byoyomi_time;
		ti->len.t.byoyomi_periods = byoyomi_periods;
		ti->len.t.byoyomi_stones = byoyomi_stones;
		ti->len.t.canadian = byoyomi_stones > 0;
		if (byoyomi_time > 0) {
			if (ti->len.t.byoyomi_periods < 1)
				ti->len.t.byoyomi_periods = 1;
			if (ti->len.t.byoyomi_stones < 1)
				ti->len.t.byoyomi_stones = 1;
		} else {
			assert(!ti->len.t.byoyomi_periods && !ti->len.t.byoyomi_stones);
		}
		ti->len.t.byoyomi_time_max = ti->len.t.byoyomi_time;
		ti->len.t.byoyomi_stones_max = ti->len.t.byoyomi_stones;
	}
}
void time_settings ( struct time_info * ti , int main_time , int byoyomi_time , int byoyomi_stones , int byoyomi_periods ) { if ( main_time < 0 ) { ti -> period = TT_NULL ; } else { ti -> period = main_time > 0 ? TT_TOTAL : TT_MOVE ; ti -> dim = TD_WALLTIME ; ti -> len . t . timer_start = 0 ; ti -> len . t . main_time = ( double ) main_time ; ti -> len . t . byoyomi_time = ( double ) byoyomi_time ; ti -> len . t . byoyomi_periods = byoyomi_periods ; ti -> len . t . byoyomi_stones = byoyomi_stones ; ti -> len . t . canadian = byoyomi_stones > 0 ; if ( byoyomi_time > 0 ) { if ( ti -> len . t . byoyomi_periods < 1 ) ti -> len . t . byoyomi_periods = 1 ; if ( ti -> len . t . byoyomi_stones < 1 ) ti -> len . t . byoyomi_stones = 1 ; } else { assert ( ! ti -> len . t . byoyomi_periods && ! ti -> len . t . byoyomi_stones ) ; } ti -> len . t . byoyomi_time_max = ti -> len . t . byoyomi_time ; ti -> len . t . byoyomi_stones_max = ti -> len . t . byoyomi_stones ; } }
Update time settings according to gtp time_settings or kgs-time_settings command.
Update time settings according to gtp time_settings or kgs - time_settings command .
// no time limit, rely on engine default /* Normally, only one of byoyomi_periods and
			 * byoyomi_stones arguments will be > 0. However,
			 * our data structure uses generalized byoyomi
			 * specification that will assume "1 byoyomi period
			 * of N stones" for Canadian byoyomi and "N byoyomi
			 * periods of 1 stone" for Japanese byoyomi. */