Permalink
Browse files

Additional renaming from DON

Assorted renaming and triviality.

No functional change.
  • Loading branch information...
1 parent ffd6685 commit e4695f15bc62c0e34572b3a995e25b7461d2ae90 @mcostalba committed Feb 14, 2014
Showing with 21 additions and 20 deletions.
  1. +6 −6 src/bitbase.cpp
  2. +3 −3 src/misc.h
  3. +3 −3 src/movegen.cpp
  4. +4 −4 src/movepick.cpp
  5. +1 −1 src/movepick.h
  6. +4 −3 src/types.h
View
@@ -26,10 +26,10 @@
namespace {
// There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7
- const unsigned IndexMax = 2*24*64*64; // stm * psq * wksq * bksq = 196608
+ const unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608
// Each uint32_t stores results of 32 positions, one per bit
- uint32_t KPKBitbase[IndexMax / 32];
+ uint32_t KPKBitbase[MAX_INDEX / 32];
// A KPK bitbase index is an integer in [0, IndexMax] range
//
@@ -84,20 +84,20 @@ void Bitbases::init_kpk() {
unsigned idx, repeat = 1;
std::vector<KPKPosition> db;
- db.reserve(IndexMax);
+ db.reserve(MAX_INDEX);
// Initialize db with known win / draw positions
- for (idx = 0; idx < IndexMax; ++idx)
+ for (idx = 0; idx < MAX_INDEX; ++idx)
db.push_back(KPKPosition(idx));
// Iterate through the positions until none of the unknown positions can be
// changed to either wins or draws (15 cycles needed).
while (repeat)
- for (repeat = idx = 0; idx < IndexMax; ++idx)
+ for (repeat = idx = 0; idx < MAX_INDEX; ++idx)
repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN);
// Map 32 results into one KPKBitbase[] entry
- for (idx = 0; idx < IndexMax; ++idx)
+ for (idx = 0; idx < MAX_INDEX; ++idx)
if (db[idx] == WIN)
KPKBitbase[idx / 32] |= 1 << (idx & 0x1F);
}
View
@@ -51,11 +51,11 @@ namespace Time {
template<class Entry, int Size>
struct HashTable {
- HashTable() : e(Size, Entry()) {}
- Entry* operator[](Key k) { return &e[(uint32_t)k & (Size - 1)]; }
+ HashTable() : table(Size, Entry()) {}
+ Entry* operator[](Key k) { return &table[(uint32_t)k & (Size - 1)]; }
private:
- std::vector<Entry> e;
+ std::vector<Entry> table;
};
View
@@ -46,10 +46,10 @@ namespace {
assert(!pos.checkers());
- const int K = Chess960 ? kto > kfrom ? -1 : 1
- : Side == KING_SIDE ? -1 : 1;
+ const Square K = Chess960 ? kto > kfrom ? DELTA_W : DELTA_E
+ : Side == KING_SIDE ? DELTA_W : DELTA_E;
- for (Square s = kto; s != kfrom; s += (Square)K)
+ for (Square s = kto; s != kfrom; s += K)
if (pos.attackers_to(s) & enemies)
return mlist;
View
@@ -210,10 +210,10 @@ void MovePicker::score<EVASIONS>() {
}
-/// generate_next() generates, scores and sorts the next bunch of moves, when
-/// there are no more moves to try for the current phase.
+/// generate_next_stage() generates, scores and sorts the next bunch of moves,
+/// when there are no more moves to try for the current stage.
-void MovePicker::generate_next() {
+void MovePicker::generate_next_stage() {
cur = moves;
@@ -305,7 +305,7 @@ Move MovePicker::next_move<false>() {
while (true)
{
while (cur == end)
- generate_next();
+ generate_next_stage();
switch (stage) {
View
@@ -92,7 +92,7 @@ class MovePicker {
private:
template<GenType> void score();
- void generate_next();
+ void generate_next_stage();
const Position& pos;
const HistoryStats& history;
View
@@ -98,6 +98,7 @@ const int MAX_PLY_PLUS_6 = MAX_PLY + 6;
/// bit 6-11: origin square (from 0 to 63)
/// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2)
/// bit 14-15: special move flag: promotion (1), en passant (2), castling (3)
+/// NOTE: EN-PASSANT bit is set only when a pawn can be captured
///
/// Special cases are MOVE_NONE and MOVE_NULL. We can sneak these in because in
/// any normal move destination square is always different from origin square
@@ -260,12 +261,12 @@ inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000
/// standard compliant, seems to work for Intel and MSVC.
#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER))
-inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); }
+inline Value eg_value(Score s) { return Value(int16_t(s & 0xFFFF)); }
#else
inline Value eg_value(Score s) {
- return Value((int)(unsigned(s) & 0x7fffu) - (int)(unsigned(s) & 0x8000u));
+ return Value((int)(unsigned(s) & 0x7FFFU) - (int)(unsigned(s) & 0x8000U));
}
#endif
@@ -295,7 +296,7 @@ ENABLE_OPERATORS_ON(Square)
ENABLE_OPERATORS_ON(File)
ENABLE_OPERATORS_ON(Rank)
-/// Added operators for adding integers to a Value
+/// Additional operators to add integers to a Value
inline Value operator+(Value v, int i) { return Value(int(v) + i); }
inline Value operator-(Value v, int i) { return Value(int(v) - i); }

0 comments on commit e4695f1

Please sign in to comment.