Cute Chess  0.1
tournamentpair.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 TOURNAMENTPAIR_H
19 #define TOURNAMENTPAIR_H
20 
30 class LIB_EXPORT TournamentPair
31 {
32  public:
40  TournamentPair(int firstPlayer = -1,
41  int secondPlayer = -1);
42 
44  int firstPlayer() const;
46  int secondPlayer() const;
51  bool hasOriginalOrder() const;
59  int leader() const;
66  bool hasSamePlayers(const TournamentPair* other) const;
71  bool isValid() const;
76  int gamesStarted() const;
78  void addStartedGame();
80  int gamesFinished() const;
82  int gamesInProgress() const;
87  int scoreSum() const;
89  int scoreDiff() const;
93  int firstScore() const;
98  void addFirstScore(int score);
102  int secondScore() const;
107  void addSecondScore(int score);
112  void swapPlayers();
113 
114  private:
115  struct Player
116  {
117  int index;
118  int score;
119  };
120 
121  Player m_first;
122  Player m_second;
123  int m_gamesStarted;
124  bool m_hasOriginalOrder;
125 };
126 
127 #endif // TOURNAMENTPAIR_H
A single encounter in a tournament.
Definition: tournamentpair.h:30