- const mainTimeValue = parseInt(mainTime[1]);
- const mainTimeUnit = mainTime[2];
- if (isNaN(mainTimeValue) || mainTimeValue <= 0)
- return "Main time should be strictly positive";
- c.mainTime = timeUnitToSeconds(mainTimeValue, mainTimeUnit);
- if (tcParts.length >= 2)
- {
- const increment = tcParts[1].match(/([0-9]+)([smhd])/);
- if (!increment)
- return "Wrong time control";
- const incrementValue = parseInt(increment[1]);
- const incrementUnit = increment[2];
- if (isLargerUnit(incrementUnit, mainTimeUnit))
- return "Increment unit cannot be larger than main unit";
- if (isNaN(incrementValue) || incrementValue < 0)
- return "Increment must be positive";
- c.increment = timeUnitToSeconds(incrementValue, incrementUnit);
- }
+ // Less than 3 days ==> live game (TODO: heuristic... 40 moves also)
+ c.liveGame = (tc.mainTime + 40 * tc.increment < 3*24*60*60);