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

Method getAllMoves

MachineGame.cpp:45–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void MachineGame::getAllMoves(QVector<ChessStep *> &steps, bool forRed)
46{
47 int start = forRed ? 16 : 0;
48 int end = forRed ? 32 : 16;
49
50 for (int id = start; id < end; id++) {
51 if (m_ChessPieces[id].m_bDead)
52 continue;
53
54 for (int row = 0; row < 10; row++) {
55 for (int col = 0; col < 9; col++) {
56 int targetId = getStoneId(row, col);
57 if (targetId != -1 && sameColor(id, targetId))
58 continue;
59 int killId = (targetId != -1) ? targetId : -1;
60 if (canMove(id, killId, row, col))
61 saveStep(id, killId, row, col, steps);
62 }
63 }
64 }
65}
66
67void MachineGame::mouseReleaseEvent(QMouseEvent *ev)
68{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected