MCPcopy Create free account
hub / github.com/XMuli/ChineseChess / MachineGame

Class MachineGame

MachineGame.h:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13enum class AIDifficulty { Easy = 0, Medium = 1, Hard = 2 };
14
15class MachineGame : public ChessBoard
16{
17public:
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
37protected:
38 AIDifficulty m_difficulty;
39 bool m_bAiIsRed = false; // AI 默认执黑
40};
41
42#endif // MACHINEGAME_H

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected