diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-03 21:56:36 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-03 21:56:36 +0200 |
| commit | 27e879c62ecc019591201b1b1068b0c41870cfab (patch) | |
| tree | c012f4f9991af93ed6b0c1b73dabf72815696707 /src/board/fen.cpp | |
| parent | 9acc4d8b4fb616e8a0b0d2fed85a752c3a86ccc6 (diff) | |
a big hell of a commit
Diffstat (limited to 'src/board/fen.cpp')
| -rw-r--r-- | src/board/fen.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/board/fen.cpp b/src/board/fen.cpp index fc52bfe..c4c5e7a 100644 --- a/src/board/fen.cpp +++ b/src/board/fen.cpp @@ -2,7 +2,6 @@ #include "board.hpp" #include <cassert> #include <cctype> -#include <cstdint> #include <cstdlib> #include <print> #include <string> @@ -14,7 +13,7 @@ bool BLACK = false; void setBoardFen(const std::string fen, Game *g) { // example fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 int file = 0; - int rank = 0; + int rank = 7; Position enpassant = {}; enum parserState { @@ -52,14 +51,6 @@ void setBoardFen(const std::string fen, Game *g) { } } if (parser_state == ENPASSANT) { - if (toupper(c) >= 'A' && toupper(c) <= 'H') { - enpassant.file = static_cast<uint8_t>(toupper(c) - 'A'); - g->canEnpassant = true; - } - if (c >= '1' && c <= '8') { - enpassant.rank = static_cast<uint8_t>(c - '0'); - g->canEnpassant = true; - } continue; } if (parser_state == CASTLE) { @@ -111,8 +102,8 @@ void setBoardFen(const std::string fen, Game *g) { } if (c == '/') { file = 0; - rank++; - if (rank >= 8) { + rank--; + if (rank < 0) { std::println("Fatal: rank was to big"); assert(false && "Malformed rank"); exit(1); |
