protected override GameCounterHistoryItem HandleIncrementB() { var npb = GameCountB + 1; if (SatisfiesSetEndingCondition(npb, GameCountA)) { npb = -npb; } else { EnumTeams newServiceRight = CurrentServiceRight.Flip(); return(new GameCounterHistoryItem(NormalGamePointCounterFactory.Create(newServiceRight), new TeamedValuePair <int>(GameCountA, npb), newServiceRight)); } return(new GameCounterHistoryItem(null, new TeamedValuePair <int>(GameCountA, npb), CurrentServiceRight)); }
protected override GameCounterHistoryItem HandleIncrementB() { var npb = GameCountB + 1; if (CurrentPointCounter is TieBrakingPointCounter || SatisfiesGameEndingCondition(npb, GameCountA)) { npb = -npb; return(new GameCounterHistoryItem(null, new TeamedValuePair <int>(GameCountA, npb), CurrentServiceRight)); } else { var newPoints = new TeamedValuePair <int>(GameCountA, npb); EnumTeams nsr = CurrentServiceRight.Flip(); return(SatisfiesTieBreakingCondition(npb, GameCountA) ? new GameCounterHistoryItem(TieBreakingGamePointCounterFactory.Create(nsr), newPoints, nsr) : new GameCounterHistoryItem(NormalGamePointCounterFactory.Create(nsr), newPoints, nsr)); } }
private EnumTeams FlipIfEven(int newPointSum) => newPointSum < 0 ? CurrentServiceRight : ((newPointSum & 1) > 0 ? CurrentServiceRight.Flip() : CurrentServiceRight);