mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-18 16:16:23 +08:00
Avoid copy a Position to get a move's san notation
In move_to_san() we create by copy a new position just to detect if move gives check. This could be very costly in line_to_san() that calls move_to_san() for every move, so create the position only once and pass a reference to move_to_san() No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -356,8 +356,9 @@ void Position::print(Move m) const {
|
||||
std::cout << std::endl;
|
||||
if (m != MOVE_NONE)
|
||||
{
|
||||
Position p(*this);
|
||||
string col = (color_of_piece_on(move_from(m)) == BLACK ? ".." : "");
|
||||
std::cout << "Move is: " << col << move_to_san(*this, m) << std::endl;
|
||||
std::cout << "Move is: " << col << move_to_san(p, m) << std::endl;
|
||||
}
|
||||
for (Rank rank = RANK_8; rank >= RANK_1; rank--)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user