File indexing completed on 2024-05-12 04:04:16

0001 /*
0002     This file is part of Knights, a chess board for KDE SC 4.
0003     SPDX-FileCopyrightText: 2011 Miha Čančula <miha@noughmad.eu>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef KNIGHTS_UCIPROTOCOL_H
0009 #define KNIGHTS_UCIPROTOCOL_H
0010 
0011 #include "proto/computerprotocol.h"
0012 #include <QStack>
0013 
0014 
0015 namespace Knights {
0016 
0017 class UciProtocol : public ComputerProtocol {
0018 
0019 public:
0020     explicit UciProtocol(QObject* parent = nullptr);
0021     ~UciProtocol() override;
0022 
0023     Features supportedFeatures() override;
0024     void declineOffer(const Knights::Offer& offer) override;
0025     void acceptOffer(const Knights::Offer& offer) override;
0026     void makeOffer(const Knights::Offer& offer) override;
0027     void startGame() override;
0028     void init() override;
0029     void move(const Knights::Move& m) override;
0030     void setDifficulty(int depth, int memory) override;
0031 
0032 private Q_SLOTS:
0033     void changeCurrentTime(Knights::Color color, const QTime& time);
0034     void requestNextMove();
0035 
0036 protected:
0037     bool parseStub(const QString& line) override;
0038     bool parseLine(const QString& line) override;
0039 
0040 private:
0041     QStack<Move> mMoveHistory;
0042     int mWhiteTime;
0043     int mBlackTime;
0044     Move mPonderMove;
0045     int mDifficulty;
0046 };
0047 
0048 }
0049 
0050 #endif // KNIGHTS_UCIPROTOCOL_H