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