| 13 | enum class AIDifficulty { Easy = 0, Medium = 1, Hard = 2 }; |
| 14 | |
| 15 | class MachineGame : public ChessBoard |
| 16 | { |
| 17 | public: |
| 18 | MachineGame(AIDifficulty diff = AIDifficulty::Medium); |
| 19 | ~MachineGame(); |
| 20 | |
| 21 | void saveStep(int moveID, int checkedID, int row, int col, QVector<ChessStep*>& steps); |
| 22 | void getAllMoves(QVector<ChessStep*>& steps, bool forRed); |
| 23 | |
| 24 | void mouseReleaseEvent(QMouseEvent *ev) override; |
| 25 | |
| 26 | void fakeMove(ChessStep* step); |
| 27 | void unFakeMove(ChessStep* step); |
| 28 | int calcScore(); |
| 29 | int alphaBeta(int depth, int alpha, int beta, bool isMaximizing); |
| 30 | ChessStep* getBestMove(); |
| 31 | void machineChooseAndMovePieces(); |
| 32 | |
| 33 | int getSearchDepth() const; |
| 34 | bool isAiRed() const { return m_bAiIsRed; } |
| 35 | void setAiIsRed(bool red) { m_bAiIsRed = red; } |
| 36 | |
| 37 | protected: |
| 38 | AIDifficulty m_difficulty; |
| 39 | bool m_bAiIsRed = false; // AI 默认执黑 |
| 40 | }; |
| 41 | |
| 42 | #endif // MACHINEGAME_H |
nothing calls this directly
no outgoing calls
no test coverage detected