From d09cbd54bc117cfac9dc94c8e1de3c3cb7b57911 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 20 Sep 2020 16:12:48 +0800 Subject: [PATCH] =?UTF-8?q?position:=20=E6=9B=B4=E5=A4=9A=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20file=5Fof(s)=20=E5=92=8C=20rank=5Fof(s)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/position.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index bc9a7844..83ebe218 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -627,9 +627,6 @@ bool Position::put_piece(Square s, bool updateCmdlist) start(); } - file = file_of(s); - rank = rank_of(s); - if (phase == PHASE_PLACING) { piece = (Piece)((0x01 | (sideToMove << PLAYER_SHIFT)) + rule.nTotalPiecesEachSide - pieceCountInHand[us]); pieceCountInHand[us]--; @@ -643,8 +640,7 @@ bool Position::put_piece(Square s, bool updateCmdlist) byTypeBB[us] |= s; if (updateCmdlist) { - sprintf(cmdline, "(%1u,%1u)", - file, rank); + sprintf(cmdline, "(%1u,%1u)", file_of(s), rank_of(s)); gamePly++; } @@ -700,8 +696,9 @@ bool Position::put_piece(Square s, bool updateCmdlist) } if (updateCmdlist) { - sprintf(cmdline, "(%1u,%1u)->(%1u,%1u)", currentSquare / RANK_NB, currentSquare % RANK_NB + 1, - file, rank); + sprintf(cmdline, "(%1u,%1u)->(%1u,%1u)", + file_of(currentSquare), rank_of(currentSquare), + file_of(s), rank_of(s)); gamePly++; st->rule50++; } @@ -779,9 +776,7 @@ bool Position::remove_piece(Square s, bool updateCmdlist) pieceCountOnBoard[them]--; if (updateCmdlist) { - File file = file_of(s); - Rank rank = rank_of(s); - sprintf(cmdline, "-(%1u,%1u)", file, rank); + sprintf(cmdline, "-(%1u,%1u)", file_of(s), rank_of(s)); gamePly++; st->rule50 = 0; }