position: 更多使用 file_of(s) 和 rank_of(s)
This commit is contained in:
parent
a45a8006e5
commit
d09cbd54bc
|
@ -627,9 +627,6 @@ bool Position::put_piece(Square s, bool updateCmdlist)
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
file = file_of(s);
|
|
||||||
rank = rank_of(s);
|
|
||||||
|
|
||||||
if (phase == PHASE_PLACING) {
|
if (phase == PHASE_PLACING) {
|
||||||
piece = (Piece)((0x01 | (sideToMove << PLAYER_SHIFT)) + rule.nTotalPiecesEachSide - pieceCountInHand[us]);
|
piece = (Piece)((0x01 | (sideToMove << PLAYER_SHIFT)) + rule.nTotalPiecesEachSide - pieceCountInHand[us]);
|
||||||
pieceCountInHand[us]--;
|
pieceCountInHand[us]--;
|
||||||
|
@ -643,8 +640,7 @@ bool Position::put_piece(Square s, bool updateCmdlist)
|
||||||
byTypeBB[us] |= s;
|
byTypeBB[us] |= s;
|
||||||
|
|
||||||
if (updateCmdlist) {
|
if (updateCmdlist) {
|
||||||
sprintf(cmdline, "(%1u,%1u)",
|
sprintf(cmdline, "(%1u,%1u)", file_of(s), rank_of(s));
|
||||||
file, rank);
|
|
||||||
gamePly++;
|
gamePly++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,8 +696,9 @@ bool Position::put_piece(Square s, bool updateCmdlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateCmdlist) {
|
if (updateCmdlist) {
|
||||||
sprintf(cmdline, "(%1u,%1u)->(%1u,%1u)", currentSquare / RANK_NB, currentSquare % RANK_NB + 1,
|
sprintf(cmdline, "(%1u,%1u)->(%1u,%1u)",
|
||||||
file, rank);
|
file_of(currentSquare), rank_of(currentSquare),
|
||||||
|
file_of(s), rank_of(s));
|
||||||
gamePly++;
|
gamePly++;
|
||||||
st->rule50++;
|
st->rule50++;
|
||||||
}
|
}
|
||||||
|
@ -779,9 +776,7 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
|
||||||
pieceCountOnBoard[them]--;
|
pieceCountOnBoard[them]--;
|
||||||
|
|
||||||
if (updateCmdlist) {
|
if (updateCmdlist) {
|
||||||
File file = file_of(s);
|
sprintf(cmdline, "-(%1u,%1u)", file_of(s), rank_of(s));
|
||||||
Rank rank = rank_of(s);
|
|
||||||
sprintf(cmdline, "-(%1u,%1u)", file, rank);
|
|
||||||
gamePly++;
|
gamePly++;
|
||||||
st->rule50 = 0;
|
st->rule50 = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue