]> git.sesse.net Git - stockfish/commitdiff
Sync some common names
authorMarco Costalba <mcostalba@gmail.com>
Sun, 6 Apr 2014 08:50:27 +0000 (10:50 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 6 Apr 2014 09:26:12 +0000 (11:26 +0200)
No functional change.

13 files changed:
src/bitboard.cpp
src/bitboard.h
src/book.cpp
src/material.h
src/misc.cpp
src/movepick.cpp
src/movepick.h
src/notation.cpp
src/position.cpp
src/position.h
src/search.cpp
src/types.h
src/ucioption.cpp

index d4b8bcfdf2cabb53d59e20ff8a055688db6a54a8..bfacc4121a0312b2d2461239008344c940c3857f 100644 (file)
@@ -131,10 +131,10 @@ const std::string Bitboards::pretty(Bitboard b) {
 
   std::string s = "+---+---+---+---+---+---+---+---+\n";
 
 
   std::string s = "+---+---+---+---+---+---+---+---+\n";
 
-  for (Rank rank = RANK_8; rank >= RANK_1; --rank)
+  for (Rank r = RANK_8; r >= RANK_1; --r)
   {
   {
-      for (File file = FILE_A; file <= FILE_H; ++file)
-          s.append(b & make_square(file, rank) ? "| X " : "|   ");
+      for (File f = FILE_A; f <= FILE_H; ++f)
+          s.append(b & make_square(f, r) ? "| X " : "|   ");
 
       s.append("|\n+---+---+---+---+---+---+---+---+\n");
   }
 
       s.append("|\n+---+---+---+---+---+---+---+---+\n");
   }
index a6850ba0f22b2db576697bbdb849618386ab4eed..3ff0408a61b16faab014965ed063af2c85124a0c 100644 (file)
@@ -254,14 +254,14 @@ inline Bitboard attacks_bb(Square s, Bitboard occ) {
   return (Pt == ROOK ? RAttacks : BAttacks)[s][magic_index<Pt>(s, occ)];
 }
 
   return (Pt == ROOK ? RAttacks : BAttacks)[s][magic_index<Pt>(s, occ)];
 }
 
-inline Bitboard attacks_bb(Piece p, Square s, Bitboard occ) {
+inline Bitboard attacks_bb(Piece pc, Square s, Bitboard occ) {
 
 
-  switch (type_of(p))
+  switch (type_of(pc))
   {
   case BISHOP: return attacks_bb<BISHOP>(s, occ);
   case ROOK  : return attacks_bb<ROOK>(s, occ);
   case QUEEN : return attacks_bb<BISHOP>(s, occ) | attacks_bb<ROOK>(s, occ);
   {
   case BISHOP: return attacks_bb<BISHOP>(s, occ);
   case ROOK  : return attacks_bb<ROOK>(s, occ);
   case QUEEN : return attacks_bb<BISHOP>(s, occ) | attacks_bb<ROOK>(s, occ);
-  default    : return StepAttacksBB[p][s];
+  default    : return StepAttacksBB[pc][s];
   }
 }
 
   }
 }
 
@@ -273,15 +273,15 @@ inline Bitboard attacks_bb(Piece p, Square s, Bitboard occ) {
 #  if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
 
 FORCE_INLINE Square lsb(Bitboard b) {
 #  if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
 
 FORCE_INLINE Square lsb(Bitboard b) {
-  unsigned long index;
-  _BitScanForward64(&index, b);
-  return (Square) index;
+  unsigned long idx;
+  _BitScanForward64(&idx, b);
+  return (Square) idx;
 }
 
 FORCE_INLINE Square msb(Bitboard b) {
 }
 
 FORCE_INLINE Square msb(Bitboard b) {
-  unsigned long index;
-  _BitScanReverse64(&index, b);
-  return (Square) index;
+  unsigned long idx;
+  _BitScanReverse64(&idx, b);
+  return (Square) idx;
 }
 
 #  elif defined(__arm__)
 }
 
 #  elif defined(__arm__)
@@ -302,15 +302,15 @@ FORCE_INLINE Square lsb(Bitboard b) {
 #  else
 
 FORCE_INLINE Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen
 #  else
 
 FORCE_INLINE Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen
-  Bitboard index;
-  __asm__("bsfq %1, %0": "=r"(index): "rm"(b) );
-  return (Square) index;
+  Bitboard idx;
+  __asm__("bsfq %1, %0": "=r"(idx): "rm"(b) );
+  return (Square) idx;
 }
 
 FORCE_INLINE Square msb(Bitboard b) {
 }
 
 FORCE_INLINE Square msb(Bitboard b) {
-  Bitboard index;
-  __asm__("bsrq %1, %0": "=r"(index): "rm"(b) );
-  return (Square) index;
+  Bitboard idx;
+  __asm__("bsrq %1, %0": "=r"(idx): "rm"(b) );
+  return (Square) idx;
 }
 
 #  endif
 }
 
 #  endif
index c27e878c194642fdb1b5bd24dc4acf1faea48d36..fbbc3fee3998c5723574743348faf68201187912 100644 (file)
@@ -326,10 +326,10 @@ namespace {
     while (b)
     {
         Square s = pop_lsb(&b);
     while (b)
     {
         Square s = pop_lsb(&b);
-        Piece p = pos.piece_on(s);
+        Piece pc = pos.piece_on(s);
 
         // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11
 
         // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11
-        key ^= PG.Zobrist.psq[2 * (type_of(p) - 1) + (color_of(p) == WHITE)][s];
+        key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s];
     }
 
     b = pos.can_castle(ANY_CASTLING);
     }
 
     b = pos.can_castle(ANY_CASTLING);
index 8ca13cd005e09bd8178a7d66d66362ee7ca5aee9..023d4497e456f6c5e0494a763f87f8a552260c19 100644 (file)
@@ -42,7 +42,7 @@ struct Entry {
   Score space_weight() const { return spaceWeight; }
   Phase game_phase() const { return gamePhase; }
   bool specialized_eval_exists() const { return evaluationFunction != NULL; }
   Score space_weight() const { return spaceWeight; }
   Phase game_phase() const { return gamePhase; }
   bool specialized_eval_exists() const { return evaluationFunction != NULL; }
-  Value evaluate(const Position& p) const { return (*evaluationFunction)(p); }
+  Value evaluate(const Position& pos) const { return (*evaluationFunction)(pos); }
   ScaleFactor scale_factor(const Position& pos, Color c) const;
 
   Key key;
   ScaleFactor scale_factor(const Position& pos, Color c) const;
 
   Key key;
index 13923a7b901a75b44ed879a610bf90c1d2e63bdb..69bf0a372bc1d2c7683dc85d00af6d8fa30e537c 100644 (file)
@@ -40,22 +40,22 @@ const string engine_info(bool to_uci) {
 
   const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
   string month, day, year;
 
   const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
   string month, day, year;
-  stringstream s, date(__DATE__); // From compiler, format is "Sep 21 2008"
+  stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008"
 
 
-  s << "Stockfish " << Version << setfill('0');
+  ss << "Stockfish " << Version << setfill('0');
 
   if (Version.empty())
   {
       date >> month >> day >> year;
 
   if (Version.empty())
   {
       date >> month >> day >> year;
-      s << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
+      ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
   }
 
   }
 
-  s << (Is64Bit ? " 64" : "")
-    << (HasPopCnt ? " SSE4.2" : "")
-    << (to_uci ? "\nid author ": " by ")
-    << "Tord Romstad, Marco Costalba and Joona Kiiski";
+  ss << (Is64Bit ? " 64" : "")
+     << (HasPopCnt ? " SSE4.2" : "")
+     << (to_uci ? "\nid author ": " by ")
+     << "Tord Romstad, Marco Costalba and Joona Kiiski";
 
 
-  return s.str();
+  return ss.str();
 }
 
 
 }
 
 
index b03295ddb86f987b9ad859bb447af48d939a339f..ce603d188ce5ad3d5e7add57ac1b00c4c2d599e8 100644 (file)
@@ -81,7 +81,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
   followupmoves = fm;
   ss = s;
 
   followupmoves = fm;
   ss = s;
 
-  if (p.checkers())
+  if (pos.checkers())
       stage = EVASION;
 
   else
       stage = EVASION;
 
   else
@@ -92,11 +92,11 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
 }
 
 MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
 }
 
 MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
-                       Square sq) : pos(p), history(h), cur(moves), end(moves) {
+                       Square s) : pos(p), history(h), cur(moves), end(moves) {
 
   assert(d <= DEPTH_ZERO);
 
 
   assert(d <= DEPTH_ZERO);
 
-  if (p.checkers())
+  if (pos.checkers())
       stage = EVASION;
 
   else if (d > DEPTH_QS_NO_CHECKS)
       stage = EVASION;
 
   else if (d > DEPTH_QS_NO_CHECKS)
@@ -115,7 +115,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
   else
   {
       stage = RECAPTURE;
   else
   {
       stage = RECAPTURE;
-      recaptureSquare = sq;
+      recaptureSquare = s;
       ttm = MOVE_NONE;
   }
 
       ttm = MOVE_NONE;
   }
 
index caec8d4ab37b4c73e71f963f32e546cf0ba54e99..c512d130e497dfa9bb54146371ad7a97e049ce5f 100644 (file)
@@ -42,25 +42,25 @@ struct Stats {
 
   static const Value Max = Value(2000);
 
 
   static const Value Max = Value(2000);
 
-  const T* operator[](Piece p) const { return table[p]; }
+  const T* operator[](Piece pc) const { return table[pc]; }
   void clear() { std::memset(table, 0, sizeof(table)); }
 
   void clear() { std::memset(table, 0, sizeof(table)); }
 
-  void update(Piece p, Square to, Move m) {
+  void update(Piece pc, Square to, Move m) {
 
 
-    if (m == table[p][to].first)
+    if (m == table[pc][to].first)
         return;
 
         return;
 
-    table[p][to].second = table[p][to].first;
-    table[p][to].first = m;
+    table[pc][to].second = table[pc][to].first;
+    table[pc][to].first = m;
   }
 
   }
 
-  void update(Piece p, Square to, Value v) {
+  void update(Piece pc, Square to, Value v) {
 
     if (Gain)
 
     if (Gain)
-        table[p][to] = std::max(v, table[p][to] - 1);
+        table[pc][to] = std::max(v, table[pc][to] - 1);
 
 
-    else if (abs(table[p][to] + v) < Max)
-        table[p][to] +=  v;
+    else if (abs(table[pc][to] + v) < Max)
+        table[pc][to] +=  v;
   }
 
 private:
   }
 
 private:
index 371b08a1a264b2b4d3e41953a73c2ca7b3d45d41..a2c5aa68206ff5a2071a14f4092c58d33a823f86 100644 (file)
@@ -132,9 +132,9 @@ const string move_to_san(Position& pos, Move m) {
 
           while (b)
           {
 
           while (b)
           {
-              Square sq = pop_lsb(&b);
-              if (!pos.legal(make_move(sq, to), pos.pinned_pieces(us)))
-                  others ^= sq;
+              Square s = pop_lsb(&b);
+              if (!pos.legal(make_move(s, to), pos.pinned_pieces(us)))
+                  others ^= s;
           }
 
           if (!others)
           }
 
           if (!others)
index 788a220769c23cde1e1a15ce1298d8c32651e44f..57c4bc32cb1611da5bd0b5c8183abd28960232cc 100644 (file)
@@ -388,21 +388,21 @@ const string Position::fen() const {
   int emptyCnt;
   std::ostringstream ss;
 
   int emptyCnt;
   std::ostringstream ss;
 
-  for (Rank rank = RANK_8; rank >= RANK_1; --rank)
+  for (Rank r = RANK_8; r >= RANK_1; --r)
   {
   {
-      for (File file = FILE_A; file <= FILE_H; ++file)
+      for (File f = FILE_A; f <= FILE_H; ++f)
       {
       {
-          for (emptyCnt = 0; file <= FILE_H && empty(make_square(file, rank)); ++file)
+          for (emptyCnt = 0; f <= FILE_H && empty(make_square(f, r)); ++f)
               ++emptyCnt;
 
           if (emptyCnt)
               ss << emptyCnt;
 
               ++emptyCnt;
 
           if (emptyCnt)
               ss << emptyCnt;
 
-          if (file <= FILE_H)
-              ss << PieceToChar[piece_on(make_square(file, rank))];
+          if (f <= FILE_H)
+              ss << PieceToChar[piece_on(make_square(f, r))];
       }
 
       }
 
-      if (rank > RANK_1)
+      if (r > RANK_1)
           ss << '/';
   }
 
           ss << '/';
   }
 
@@ -433,7 +433,7 @@ const string Position::fen() const {
 /// Position::pretty() returns an ASCII representation of the position to be
 /// printed to the standard output together with the move's san notation.
 
 /// Position::pretty() returns an ASCII representation of the position to be
 /// printed to the standard output together with the move's san notation.
 
-const string Position::pretty(Move move) const {
+const string Position::pretty(Move m) const {
 
   const string dottedLine =            "\n+---+---+---+---+---+---+---+---+";
   const string twoRows =  dottedLine + "\n|   | . |   | . |   | . |   | . |"
 
   const string dottedLine =            "\n+---+---+---+---+---+---+---+---+";
   const string twoRows =  dottedLine + "\n|   | . |   | . |   | . |   | . |"
@@ -449,9 +449,9 @@ const string Position::pretty(Move move) const {
 
   std::ostringstream ss;
 
 
   std::ostringstream ss;
 
-  if (move)
+  if (m)
       ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
       ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
-         << move_to_san(*const_cast<Position*>(this), move);
+         << move_to_san(*const_cast<Position*>(this), m);
 
   ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
      << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
 
   ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
      << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
@@ -1147,9 +1147,9 @@ void Position::flip() {
   string f, token;
   std::stringstream ss(fen());
 
   string f, token;
   std::stringstream ss(fen());
 
-  for (Rank rank = RANK_8; rank >= RANK_1; --rank) // Piece placement
+  for (Rank r = RANK_8; r >= RANK_1; --r) // Piece placement
   {
   {
-      std::getline(ss, token, rank > RANK_1 ? '/' : ' ');
+      std::getline(ss, token, r > RANK_1 ? '/' : ' ');
       f.insert(0, token + (f.empty() ? " " : "/"));
   }
 
       f.insert(0, token + (f.empty() ? " " : "/"));
   }
 
index 36d65fb87b5ef11771294b6acc34fef1208a7f5f..0f88944c106c24ba1571decc2fa4702ed9b3657a 100644 (file)
@@ -75,7 +75,7 @@ const size_t StateCopySize64 = offsetof(StateInfo, key) / sizeof(uint64_t) + 1;
 class Position {
 public:
   Position() {}
 class Position {
 public:
   Position() {}
-  Position(const Position& p, Thread* t) { *this = p; thisThread = t; }
+  Position(const Position& pos, Thread* t) { *this = pos; thisThread = t; }
   Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
   Position& operator=(const Position&);
   static void init();
   Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
   Position& operator=(const Position&);
   static void init();
@@ -113,7 +113,7 @@ public:
   // Attacks to/from a given square
   Bitboard attackers_to(Square s) const;
   Bitboard attackers_to(Square s, Bitboard occ) const;
   // Attacks to/from a given square
   Bitboard attackers_to(Square s) const;
   Bitboard attackers_to(Square s, Bitboard occ) const;
-  Bitboard attacks_from(Piece p, Square s) const;
+  Bitboard attacks_from(Piece pc, Square s) const;
   template<PieceType> Bitboard attacks_from(Square s) const;
   template<PieceType> Bitboard attacks_from(Square s, Color c) const;
 
   template<PieceType> Bitboard attacks_from(Square s) const;
   template<PieceType> Bitboard attacks_from(Square s, Color c) const;
 
@@ -295,8 +295,8 @@ inline Bitboard Position::attacks_from<PAWN>(Square s, Color c) const {
   return StepAttacksBB[make_piece(c, PAWN)][s];
 }
 
   return StepAttacksBB[make_piece(c, PAWN)][s];
 }
 
-inline Bitboard Position::attacks_from(Piece p, Square s) const {
-  return attacks_bb(p, s, byTypeBB[ALL_PIECES]);
+inline Bitboard Position::attacks_from(Piece pc, Square s) const {
+  return attacks_bb(pc, s, byTypeBB[ALL_PIECES]);
 }
 
 inline Bitboard Position::attackers_to(Square s) const {
 }
 
 inline Bitboard Position::attackers_to(Square s) const {
index 05773469c64220ca2d201c151504c5446e379f8b..bb09df984b7d301b9c3c93d6faa9f9eded4a68ec 100644 (file)
@@ -219,7 +219,7 @@ void Search::think() {
           << " time: "        << Limits.time[RootColor]
           << " increment: "   << Limits.inc[RootColor]
           << " moves to go: " << Limits.movestogo
           << " time: "        << Limits.time[RootColor]
           << " increment: "   << Limits.inc[RootColor]
           << " moves to go: " << Limits.movestogo
-          << std::endl;
+          << "\n" << std::endl;
   }
 
   // Reset the threads, still sleeping: will wake up at split time
   }
 
   // Reset the threads, still sleeping: will wake up at split time
@@ -1342,7 +1342,7 @@ moves_loop: // When in check and at SpNode search starts from here
 
   string uci_pv(const Position& pos, int depth, Value alpha, Value beta) {
 
 
   string uci_pv(const Position& pos, int depth, Value alpha, Value beta) {
 
-    std::stringstream s;
+    std::stringstream ss;
     Time::point elapsed = Time::now() - SearchTime + 1;
     size_t uciPVSize = std::min((size_t)Options["MultiPV"], RootMoves.size());
     int selDepth = 0;
     Time::point elapsed = Time::now() - SearchTime + 1;
     size_t uciPVSize = std::min((size_t)Options["MultiPV"], RootMoves.size());
     int selDepth = 0;
@@ -1361,23 +1361,23 @@ moves_loop: // When in check and at SpNode search starts from here
         int d   = updated ? depth : depth - 1;
         Value v = updated ? RootMoves[i].score : RootMoves[i].prevScore;
 
         int d   = updated ? depth : depth - 1;
         Value v = updated ? RootMoves[i].score : RootMoves[i].prevScore;
 
-        if (s.rdbuf()->in_avail()) // Not at first line
-            s << "\n";
+        if (ss.rdbuf()->in_avail()) // Not at first line
+            ss << "\n";
 
 
-        s << "info depth " << d
-          << " seldepth "  << selDepth
-          << " score "     << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
-          << " nodes "     << pos.nodes_searched()
-          << " nps "       << pos.nodes_searched() * 1000 / elapsed
-          << " time "      << elapsed
-          << " multipv "   << i + 1
-          << " pv";
+        ss << "info depth " << d
+           << " seldepth "  << selDepth
+           << " score "     << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
+           << " nodes "     << pos.nodes_searched()
+           << " nps "       << pos.nodes_searched() * 1000 / elapsed
+           << " time "      << elapsed
+           << " multipv "   << i + 1
+           << " pv";
 
         for (size_t j = 0; RootMoves[i].pv[j] != MOVE_NONE; ++j)
 
         for (size_t j = 0; RootMoves[i].pv[j] != MOVE_NONE; ++j)
-            s <<  " " << move_to_uci(RootMoves[i].pv[j], pos.is_chess960());
+            ss << " " << move_to_uci(RootMoves[i].pv[j], pos.is_chess960());
     }
 
     }
 
-    return s.str();
+    return ss.str();
   }
 
 } // namespace
   }
 
 } // namespace
index ea52fe6cb5216c5c85cc5a6910b86e0ef3662812..7ebe3f61f8580b0b241a9c0580b8f83768a57fc0 100644 (file)
@@ -357,13 +357,13 @@ inline Piece make_piece(Color c, PieceType pt) {
   return Piece((c << 3) | pt);
 }
 
   return Piece((c << 3) | pt);
 }
 
-inline PieceType type_of(Piece p)  {
-  return PieceType(p & 7);
+inline PieceType type_of(Piece pc)  {
+  return PieceType(pc & 7);
 }
 
 }
 
-inline Color color_of(Piece p) {
-  assert(p != NO_PIECE);
-  return Color(p >> 3);
+inline Color color_of(Piece pc) {
+  assert(pc != NO_PIECE);
+  return Color(pc >> 3);
 }
 
 inline bool is_ok(Square s) {
 }
 
 inline bool is_ok(Square s) {
index a229027970b73bfdbf2e844331b4ac16843b9596..e117e44c862205e37f7901a0e0cc59e3a97b4bf7 100644 (file)
@@ -141,10 +141,10 @@ Option::operator std::string() const {
 
 void Option::operator<<(const Option& o) {
 
 
 void Option::operator<<(const Option& o) {
 
-  static size_t index = 0;
+  static size_t insert_order = 0;
 
   *this = o;
 
   *this = o;
-  idx = index++;
+  idx = insert_order++;
 }
 
 
 }