Fix round-robin schedule
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 8 Jun 2011 15:11:31 +0000 (17:11 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Wed, 8 Jun 2011 16:09:22 +0000 (18:09 +0200)
The first round was played twice, and the formulas used to derive the
pairing were not even-odd resistant anyway. Both even and odd number of
participants should work now.

backend.c

index 6645db1..d04fd3d 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -9746,9 +9746,9 @@ Pairing(int nr, int nPlayers, int *whitePlayer, int *blackPlayer, int *syncInter
            *whitePlayer = curRound;
            *blackPlayer = nPlayers - 1; // this is the 'bye' when nPlayer is odd
        } else {
-           *whitePlayer = curRound - pairingsPerRound + curPairing;
+           *whitePlayer = curRound - (nPlayers-1)/2 + curPairing;
            if(*whitePlayer < 0) *whitePlayer += nPlayers-1+(nPlayers&1);
-           *blackPlayer = curRound + pairingsPerRound - curPairing;
+           *blackPlayer = curRound + (nPlayers-1)/2 - curPairing;
            if(*blackPlayer >= nPlayers-1+(nPlayers&1)) *blackPlayer -= nPlayers-1+(nPlayers&1);
        }
     } else if(appData.tourneyType > 0) {