X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=blobdiff_plain;f=lasker-2.2.3%2Fbots%2Fmamer%2FTourney.cc;h=56a4b141e03784ddeac7430cf320c9c463f8e507;hp=813c938b36196fa7d071b659dabdc4043b6765e4;hb=de64701702c2b4d4d951be0e77afeda5177bc494;hpb=2090edea3ec8c89745b568f7ef61d4c332dd29a8 diff --git a/lasker-2.2.3/bots/mamer/Tourney.cc b/lasker-2.2.3/bots/mamer/Tourney.cc index 813c938..56a4b14 100644 --- a/lasker-2.2.3/bots/mamer/Tourney.cc +++ b/lasker-2.2.3/bots/mamer/Tourney.cc @@ -3,17 +3,13 @@ // // Matthew E. Moses // -// $Revision: 1.12 $ -// $Date: 2002/07/02 00:02:40 $ +// $Revision: 1.11 $ +// $Date: 1998/09/10 19:57:17 $ // -// $Author: tridge $ +// $Author: mlong $ // $Locker: $ // // $Log: Tourney.cc,v $ -// Revision 1.12 2002/07/02 00:02:40 tridge -// - fixed compile on g++ 2.96 -// - updated for lasker 'rmatch' -// // Revision 1.11 1998/09/10 19:57:17 mlong // lots of little bug fixes and a few new features // @@ -43,7 +39,7 @@ // //-------------------------------------------------------------------------- -//static char RCSid[] = "$Id: Tourney.cc,v 1.12 2002/07/02 00:02:40 tridge Exp $"; +//static char RCSid[] = "$Id: Tourney.cc,v 1.11 1998/09/10 19:57:17 mlong Exp $"; #include "Tourney.hh" #include "Mamer.hh" @@ -89,6 +85,7 @@ void Tourney::InitTourney(int n, User *u, int t, int i, char m, char s, int r, c lastCshouted = 0; status = NEW; + paused = FALSE; } //- Deconstructor --------------------------------------------------------- @@ -415,7 +412,7 @@ void Tourney::CloseAndStart(void) { params.rounds = GetPlayerCount() - 1; break; case 's': - params.rounds = (int)ceil(log22(GetPlayerCount())); + params.rounds = (int)ceil(log2(GetPlayerCount())); break; default: params.rounds = DEFAULT_ROUNDS; @@ -633,7 +630,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); @@ -802,6 +812,16 @@ void Tourney::EndTourney(void) { status = DONE; }//- End EndTourney +//- IsPaused -------------------------------------------------------- +int Tourney::IsPaused(void) { + return paused; +} + +//- SetPause ----------------------- +void Tourney::SetPause(int x) { + paused = x; +}//- End SetPause + //- Announce ---------------------------------------------------------- void Tourney::Announce(void) { char temp[128]; @@ -951,6 +971,7 @@ void Tourney::TellThemWhoTheyPlay() { while((g = gameIter.Next())) { /* note that we rely on rmatch and on the ; separated commands from lasker */ + sleep(2); gMamer.XServerCom("rmatch %s %s %i %i %c %s white ; rmatch %s %s %i %i %c %s black\n", g->whiteName, g->blackName, g->time, g->inc, params.mode, Variant, g->blackName, g->whiteName, g->time, g->inc, params.mode, Variant);