]> git.sesse.net Git - stockfish/commitdiff
Rename xxx_to_char() -> to_char()
authorMarco Costalba <mcostalba@gmail.com>
Sat, 1 Mar 2014 21:07:41 +0000 (22:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 1 Mar 2014 21:07:41 +0000 (22:07 +0100)
No functional change.

src/notation.cpp
src/position.cpp
src/types.h

index a57072ef1426d453d430dcd48e8bc803550acc1d..3ca43deb402515b61a893389bdccc96204ffe684 100644 (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)];
index 78fccbb2891d8fb70b1d7e5d406ba985c88daccf..0cea2d372faf9ed04ec813e17d7f89c269b31418 100644 (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)
index 03053591f05c5426392b5c494562fde2409a28bd..2317626e3d39cfe6604ce2fc41f7465a7ccbe8e1 100644 (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;
 }