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.

Recommended Answers

All 2 Replies

I'm really not sure I understand the question, but as it has been five days I figure I'll give it a shot... :-/

If it is just a matter of mixing whole games and half games, convert to the lowest common denominator: half games.

So for every whole game from the old system, just treat it as two half-games and divide the rating between them. (If the rating is just some number of points, give half to one and half to the other. If it is a statistical average or something, just factor in 2/2. Etc.)

In other words, if you get data from an old game, convert it to equivalent data for the new game and use the new game's code to manage it.

Hope this helps.

In other words, if you get data from an old game, convert it to equivalent data for the new game and use the new game's code to manage it.

Thanks Duoas for having a go at my rather vaguely expressed little problem. I had, in fact, contemplated doing as you propose but other bits of the program influenced me to do it opposite hand. I can express it by adapting your very quote, thus:

In other words, if you get data from a new game, convert it to equivalent data for the old game and use the old game's code to manage it.

Here is a chunk of code that shows it:

if GamesThisPlayer[Winner] + HalfGamesThisPlayer[Winner] div 2 = SampleGamesBatch then
    ProvisionalRating[Winner] := Rating[Winner];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.