Cute Chess  0.1
enginematch.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 ENGINEMATCH_H
20 #define ENGINEMATCH_H
21 
22 #include <QObject>
23 #include <QMap>
24 #include <QString>
25 #include <QElapsedTimer>
26 #include <openingbook.h>
27 
28 class ChessGame;
29 class OpeningBook;
30 class Tournament;
31 
32 
33 class EngineMatch : public QObject
34 {
35  Q_OBJECT
36 
37  public:
38  EngineMatch(Tournament* tournament, QObject* parent = nullptr);
39  virtual ~EngineMatch();
40 
41  OpeningBook* addOpeningBook(const QString& fileName);
42  void setDebugMode(bool debug);
43  void setRatingInterval(int interval);
44  void setOutcomeInterval(int interval);
45  void setBookMode(OpeningBook::AccessMode mode);
46 
47  void start();
48  void stop();
49 
50  signals:
51  void finished();
52 
53  private slots:
54  void onGameStarted(ChessGame* game, int number);
55  void onGameFinished(ChessGame* game, int number);
56  void onTournamentFinished();
57  void print(const QString& msg);
58 
59  private:
60  void printRanking();
61  void printOutcomes();
62 
63  Tournament* m_tournament;
64  bool m_debug;
65  int m_ratingInterval;
66  int m_outcomeInterval;
67  OpeningBook::AccessMode m_bookMode;
69  QElapsedTimer m_startTime;
70 };
71 
72 #endif // ENGINEMATCH_H
Definition: enginematch.h:33
Definition: chessgame.h:38
AccessMode
Definition: openingbook.h:47
Base class for chess tournaments.
Definition: tournament.h:44
A collection of opening moves for chess.
Definition: openingbook.h:43