Cute Chess  0.1
knockouttournament.h
1 /*
2  This file is part of Cute Chess.
3 
4  Cute Chess is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Cute Chess is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef KNOCKOUTTOURNAMENT_H
19 #define KNOCKOUTTOURNAMENT_H
20 
21 #include "tournament.h"
22 
23 
30 class LIB_EXPORT KnockoutTournament : public Tournament
31 {
32  Q_OBJECT
33 
34  public:
36  explicit KnockoutTournament(GameManager* gameManager,
37  QObject *parent = nullptr);
38 
39  // Inherited from Tournament
40  virtual QString type() const;
41  virtual bool canSetRoundMultiplier() const;
42  virtual QString results() const;
43 
44  protected:
45  // Inherited from Tournament
46  virtual void initializePairing();
47  virtual int gamesPerCycle() const;
48  virtual TournamentPair* nextPair(int gameNumber);
49  virtual void addScore(int player, int score);
50  virtual bool areAllGamesFinished() const;
51 
52  private:
53  static int playerSeed(int rank, int bracketSize);
54 
55  QList<int> firstRoundPlayers() const;
56  QList<int> lastRoundWinners() const;
57  bool needMoreGames(const TournamentPair* pair) const;
58 
60 };
61 
62 #endif // KNOCKOUTTOURNAMENT_H
virtual QString type() const =0
virtual bool areAllGamesFinished() const
Definition: tournament.cpp:301
virtual void initializePairing()=0
virtual TournamentPair * nextPair(int gameNumber)=0
virtual bool canSetRoundMultiplier() const
Definition: tournament.cpp:161
Knockout type chess tournament.
Definition: knockouttournament.h:30
virtual void addScore(int player, int score)
Definition: tournament.cpp:473
A class for managing chess games and players.
Definition: gamemanager.h:39
Base class for chess tournaments.
Definition: tournament.h:44
A single encounter in a tournament.
Definition: tournamentpair.h:30
virtual QString results() const
Definition: tournament.cpp:640
virtual int gamesPerCycle() const =0