1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:37:34 +00:00

LibChess: Include pawns in FEN output

Previously, the initial position would look like this:

rnbqkbnr//8/8/8/8//RNBQKBNR w KQkq - 0 1

Now, we correctly give pawns the P/p character in FEN output:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Also, we only ever have 1 or 0 characters for a piece, so let's return
`Optional<char>` instead of `StringView` from `char_for_piece()`.
This commit is contained in:
Sam Atkins 2023-04-24 11:58:52 +01:00 committed by Andreas Kling
parent 8529e660ca
commit b111782f18
2 changed files with 26 additions and 15 deletions

View file

@ -25,7 +25,11 @@ enum class Type : u8 {
None,
};
StringView char_for_piece(Type type);
enum class Notation {
Algebraic,
FEN,
};
Optional<char> char_for_piece(Type, Notation);
Chess::Type piece_for_char_promotion(StringView str);
enum class Color : u8 {