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

Method relation

ChessBoard.cpp:155–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153 }
154}
155int ChessBoard:: relation(int row1,int col1,int row2,int col2)
156{
157 // 原坐标(row1,col1)与目标坐标(row2,col2)的关系
158 // 使用原坐标与目标坐标的行相减的绝对值乘以10 加上原坐标与目标坐标的列相减的绝对值
159 // 作为关系值
160 // 关系值用于判断是否符合棋子移动规则
161 return abs(row1-row2)*10+ abs(col1-col2);
162}
163
164//是否选中该枚棋子。pt为输入参数; row, col为输出参数
165bool ChessBoard::isChecked(QPointF pt, int &row, int &col)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected