mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Teach file_to_char() about upper/lower case
This allows to further simplify Position::fen() No functional change.
This commit is contained in:
parent
9d1151575d
commit
900e2d4e1e
2 changed files with 6 additions and 6 deletions
|
@ -358,16 +358,16 @@ const string Position::fen() const {
|
|||
ss << (sideToMove == WHITE ? " w " : " b ");
|
||||
|
||||
if (can_castle(WHITE_OO))
|
||||
ss << (chess960 ? char(toupper(file_to_char(file_of(castle_rook_square(WHITE, KING_SIDE))))) : 'K');
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(WHITE, KING_SIDE)), false) : 'K');
|
||||
|
||||
if (can_castle(WHITE_OOO))
|
||||
ss << (chess960 ? char(toupper(file_to_char(file_of(castle_rook_square(WHITE, QUEEN_SIDE))))) : 'Q');
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(WHITE, QUEEN_SIDE)), false) : 'Q');
|
||||
|
||||
if (can_castle(BLACK_OO))
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, KING_SIDE))) : 'k');
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, KING_SIDE)), true) : 'k');
|
||||
|
||||
if (can_castle(BLACK_OOO))
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, QUEEN_SIDE))) : 'q');
|
||||
ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, QUEEN_SIDE)), true) : 'q');
|
||||
|
||||
if (st->castleRights == CASTLES_NONE)
|
||||
ss << '-';
|
||||
|
|
|
@ -441,8 +441,8 @@ inline int square_distance(Square s1, Square s2) {
|
|||
return SquareDistance[s1][s2];
|
||||
}
|
||||
|
||||
inline char file_to_char(File f) {
|
||||
return char(f - FILE_A + 'a');
|
||||
inline char file_to_char(File f, bool tolower = true) {
|
||||
return char(f - FILE_A + (tolower ? 'a' : 'A'));
|
||||
}
|
||||
|
||||
inline char rank_to_char(Rank r) {
|
||||
|
|
Loading…
Add table
Reference in a new issue