begin
Inc(GamesThisPlayer[Winner]);
if GamesThisPlayer[Winner] = SampleGamesBatch then
ProvisionalRating[Winner] := Rating[Winner];
Inc(GamesThisPlayer[Loser]);
if GamesThisPlayer[Loser] = SampleGamesBatch then
ProvisionalRating[Loser] := Rating[Loser]
end;
This extract of code is from a player rating program. A player either wins or loses. When a player has played a sample batch of games (20 in this case) his provisional rating is updated to his current rating.
This is how it was, but now, 2008, all players play half-games. 40 half-games = the sample batch of 20 games. This was a simple matter to recode to handle new players.
What is a neat bit of code for players whose sample batch of games span both the old and new eras? For example: 14 old games plus 12 half-games = the sample batch of 20 games.