1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Rename xxx_to_char() -> to_char()

No functional change.
This commit is contained in:
Marco Costalba 2014-03-01 22:07:41 +01:00
parent de2ba70830
commit 3d8c0f16c2
3 changed files with 16 additions and 16 deletions

View file

@ -72,7 +72,7 @@ const string move_to_uci(Move m, bool chess960) {
if (type_of(m) == CASTLING && !chess960)
to = (to > from ? FILE_G : FILE_C) | rank_of(from);
string move = square_to_string(from) + square_to_string(to);
string move = to_string(from) + to_string(to);
if (type_of(m) == PROMOTION)
move += PieceToChar[BLACK][promotion_type(m)]; // Lower case
@ -140,22 +140,22 @@ const string move_to_san(Position& pos, Move m) {
if (others)
{
if (!(others & file_bb(from)))
san += file_to_char(file_of(from));
san += to_char(file_of(from));
else if (!(others & rank_bb(from)))
san += rank_to_char(rank_of(from));
san += to_char(rank_of(from));
else
san += square_to_string(from);
san += to_string(from);
}
}
else if (pos.capture(m))
san = file_to_char(file_of(from));
san = to_char(file_of(from));
if (pos.capture(m))
san += 'x';
san += square_to_string(to);
san += to_string(to);
if (type_of(m) == PROMOTION)
san += string("=") + PieceToChar[WHITE][promotion_type(m)];

View file

@ -353,21 +353,21 @@ const string Position::fen() const {
ss << (sideToMove == WHITE ? " w " : " b ");
if (can_castle(WHITE_OO))
ss << (chess960 ? file_to_char(file_of(castling_rook_square(WHITE, KING_SIDE)), false) : 'K');
ss << (chess960 ? to_char(file_of(castling_rook_square(WHITE, KING_SIDE)), false) : 'K');
if (can_castle(WHITE_OOO))
ss << (chess960 ? file_to_char(file_of(castling_rook_square(WHITE, QUEEN_SIDE)), false) : 'Q');
ss << (chess960 ? to_char(file_of(castling_rook_square(WHITE, QUEEN_SIDE)), false) : 'Q');
if (can_castle(BLACK_OO))
ss << (chess960 ? file_to_char(file_of(castling_rook_square(BLACK, KING_SIDE)), true) : 'k');
ss << (chess960 ? to_char(file_of(castling_rook_square(BLACK, KING_SIDE)), true) : 'k');
if (can_castle(BLACK_OOO))
ss << (chess960 ? file_to_char(file_of(castling_rook_square(BLACK, QUEEN_SIDE)), true) : 'q');
ss << (chess960 ? to_char(file_of(castling_rook_square(BLACK, QUEEN_SIDE)), true) : 'q');
if (!can_castle(WHITE) && !can_castle(BLACK))
ss << '-';
ss << (ep_square() == SQ_NONE ? " - " : " " + square_to_string(ep_square()) + " ")
ss << (ep_square() == SQ_NONE ? " - " : " " + to_string(ep_square()) + " ")
<< st->rule50 << " " << 1 + (gamePly - int(sideToMove == BLACK)) / 2;
return ss.str();
@ -401,7 +401,7 @@ const string Position::pretty(Move move) const {
<< std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
for (Bitboard b = checkers(); b; )
ss << square_to_string(pop_lsb(&b)) << " ";
ss << to_string(pop_lsb(&b)) << " ";
ss << "\nLegal moves: ";
for (MoveList<LEGAL> it(*this); *it; ++it)

View file

@ -391,11 +391,11 @@ inline bool opposite_colors(Square s1, Square s2) {
return ((s >> 3) ^ s) & 1;
}
inline char file_to_char(File f, bool tolower = true) {
inline char to_char(File f, bool tolower = true) {
return char(f - FILE_A + (tolower ? 'a' : 'A'));
}
inline char rank_to_char(Rank r) {
inline char to_char(Rank r) {
return char(r - RANK_1 + '1');
}
@ -434,8 +434,8 @@ inline bool is_ok(Move m) {
#include <string>
inline const std::string square_to_string(Square s) {
char ch[] = { file_to_char(file_of(s)), rank_to_char(rank_of(s)), 0 };
inline const std::string to_string(Square s) {
char ch[] = { to_char(file_of(s)), to_char(rank_of(s)), 0 };
return ch;
}