File tree Expand file tree Collapse file tree 4 files changed +30
-2
lines changed
Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,24 @@ bool KnockoutTournament::procceedNextGame() const
242242{
243243}
244244
245+ bool KnockoutTournament::resetBook (const TournamentPair* pair) const
246+ {
247+ // Second player is a BYE
248+ if (!pair->isValid ())
249+ return false ;
250+
251+ const int iWhite = pair->firstPlayer ();
252+ const int iBlack = pair->secondPlayer ();
253+ int firstScore = pair->firstScore () + Tournament::playerAt (iWhite).builder ()->resumescore ();
254+ int secondScore = pair->secondScore () + Tournament::playerAt (iBlack).builder ()->resumescore ();
255+
256+ if ((firstScore == secondScore) && (!firstScore))
257+ {
258+ return true ;
259+ }
260+ return false ;
261+ }
262+
245263bool KnockoutTournament::needMoreGames (const TournamentPair* pair) const
246264{
247265 // Second player is a BYE
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class LIB_EXPORT KnockoutTournament : public Tournament
5555 virtual bool procceedNextGame () const ;
5656 virtual bool shouldWeStop (int white, int black, const TournamentPair* pair) const ;
5757 virtual bool shouldWeStopTour () const ;
58+ virtual bool resetBook (const TournamentPair* pair) const ;
5859 bool m_should_we_stop;
5960
6061 private:
Original file line number Diff line number Diff line change @@ -448,6 +448,11 @@ bool Tournament::fileExists(QString path) const
448448 }
449449}
450450
451+ bool Tournament::resetBook (const TournamentPair* pair) const
452+ {
453+ return false ;
454+ }
455+
451456bool Tournament::shouldWeStopTour () const
452457{
453458 QString path = " failed.txt" ;
@@ -747,6 +752,7 @@ void Tournament::startNextGame()
747752 return ;
748753
749754 bool needToStop = false ;
755+ bool needtoResetBook = false ;
750756 for (;;)
751757 {
752758 needToStop = shouldWeStopTour ();
@@ -766,7 +772,9 @@ void Tournament::startNextGame()
766772 break ;
767773 }
768774
769- if (!pair->hasSamePlayers (m_pair) && m_players.size () > 2 )
775+ needtoResetBook = resetBook (pair);
776+ qWarning () << " CAlling resetBook ,needtoResetBook:" << needtoResetBook;
777+ if (needtoResetBook || ((!pair->hasSamePlayers (m_pair) && m_players.size () > 2 )))
770778 {
771779 m_startFen.clear ();
772780 m_openingMoves.clear ();
Original file line number Diff line number Diff line change @@ -475,7 +475,8 @@ class LIB_EXPORT Tournament : public QObject
475475 virtual bool hasGauntletRatingsOrder () const ;
476476 virtual bool shouldWeStop (int white, int black, const TournamentPair* pair) const ;
477477 virtual bool shouldWeStopTour () const ;
478- virtual bool fileExists (QString path) const ;
478+ virtual bool resetBook (const TournamentPair* pair) const ;
479+ virtual bool fileExists (QString path) const ;
479480
480481
481482 private slots:
You can’t perform that action at this time.
0 commit comments