put_piece(): refactor

This commit is contained in:
Calcitem 2020-09-06 22:24:06 +08:00
parent 81f5a5e5ce
commit 2e57330126
1 changed files with 6 additions and 8 deletions

View File

@ -606,17 +606,15 @@ bool Position::put_piece(Square s, bool updateCmdlist)
Bitboard fromTo; Bitboard fromTo;
if (phase == PHASE_GAMEOVER) if (phase == PHASE_GAMEOVER ||
action != ACTION_PLACE ||
!onBoard[s] || board[s]) {
return false; return false;
}
if (phase == PHASE_READY) if (phase == PHASE_READY) {
start(); start();
}
if (action != ACTION_PLACE)
return false;
if (!onBoard[s]|| board[s])
return false;
Position::square_to_polar(s, file, rank); Position::square_to_polar(s, file, rank);