From 75ea555a410b0dd3f0f1ab9d3deaa0a6a6cf0be3 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 21 Oct 2011 23:17:31 +0200 Subject: [PATCH] Let mamer take colors into account for pairing During the pairing phase mamer now avodids pairing participants that cannot not be assigned a color without violating the absolute rules of three consecutives or imbalance. --- lasker-2.2.3/bots/mamer/Tourney.cc | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/lasker-2.2.3/bots/mamer/Tourney.cc b/lasker-2.2.3/bots/mamer/Tourney.cc index c2e3a87..401ed3e 100644 --- a/lasker-2.2.3/bots/mamer/Tourney.cc +++ b/lasker-2.2.3/bots/mamer/Tourney.cc @@ -629,7 +629,20 @@ void Tourney::SetPairingScores(TourneyPlayers *tp) { playerIter.Reset(); while((opponent = playerIter.Next())) { if(strcmp(tp->name, opponent->name) && (tp->activeFlag !=0)) { // If this isn't MY name & I am active - if((!tp->AlreadyPlayed(opponent->name)) && (!opponent->IsPaired()) && (opponent->activeFlag != 0)) { + if((!tp->AlreadyPlayed(opponent->name)) && (!opponent->IsPaired()) && (opponent->activeFlag != 0) + && (tp->ColorDue() != opponent->ColorDue() // they are due different color, never a problem + || tp->ColorDue() ? // both are due white. Check if one of them could accept black without breaking 'absolute' color rules + tp->GetConsecutiveBlacks() < 2 && + tp->GetTotalBlacks() - tp->GetTotalWhites() < 2 || + opponent->GetConsecutiveBlacks() < 2 && + opponent->GetTotalBlacks() - opponent->GetTotalWhites() < 2 + : // both are due black. Check if any of them can accept white + tp->GetConsecutiveWhites() < 2 && + tp->GetTotalWhites() - tp->GetTotalBlacks() < 2 || + opponent->GetConsecutiveWhites() < 2 && + opponent->GetTotalWhites() - opponent->GetTotalBlacks() < 2 + ) + ) { // and I haven't played this person and this person is active. (not forfeited) t = GetSortPlayer(opponent->name); score = ((abs(t->value - (me->value + offset))) * 1000); -- 1.7.0.4