diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-10 17:24:04 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-10 17:24:04 +0100 |
| commit | d877983ce7c40bf69fe3ddccf1eb93d338bab9a8 (patch) | |
| tree | ae4a4b60377efaa6f67a9e7ea66ac998019cbd0a | |
| parent | 6ebd96825576b2da8e8acf2ac85d0b82a7531424 (diff) | |
Optimizing the Play method
| -rw-r--r-- | src/ChessArbiter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp index 8612fc4..aa1ac34 100644 --- a/src/ChessArbiter.cpp +++ b/src/ChessArbiter.cpp @@ -178,13 +178,6 @@ bool ChessArbiter::Play(const std::string &move, char promote) { return (false); } - // Don't forget the plus and # sign on the SAN moves - if(IsCheckMate()){ - SAN+="#"; - } else if(IsCheck(fen.player)){ - SAN+="+"; - } - // Update position map (repetitions draw) if (positions.count(fen.board) == 0) { positions[fen.board] = 1; @@ -434,7 +427,16 @@ bool ChessArbiter::IsCheckMate() { return (false); } -std::string ChessArbiter::GetSAN() { return (SAN); } +std::string ChessArbiter::GetSAN() { + // Don't forget the plus and # sign on the SAN moves + if(IsCheckMate()){ + return SAN+"#"; + } else if(IsCheck(fen.player)){ + return SAN+ "+"; + } + return SAN; +} + char ChessArbiter::GetCapture() { return (capture); } std::string ChessArbiter::ParseSAN(const std::string &SANMove) { |
