1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 11:39:15 +00:00

Additional renaming from DON

Assorted renaming and triviality.

No functional change.
This commit is contained in:
Marco Costalba 2014-02-14 09:42:50 +01:00
parent ffd6685f79
commit e4695f15bc
6 changed files with 21 additions and 20 deletions

View file

@ -26,10 +26,10 @@
namespace { namespace {
// There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7 // 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 // 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 // A KPK bitbase index is an integer in [0, IndexMax] range
// //
@ -84,20 +84,20 @@ void Bitbases::init_kpk() {
unsigned idx, repeat = 1; unsigned idx, repeat = 1;
std::vector<KPKPosition> db; std::vector<KPKPosition> db;
db.reserve(IndexMax); db.reserve(MAX_INDEX);
// Initialize db with known win / draw positions // 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)); db.push_back(KPKPosition(idx));
// Iterate through the positions until none of the unknown positions can be // Iterate through the positions until none of the unknown positions can be
// changed to either wins or draws (15 cycles needed). // changed to either wins or draws (15 cycles needed).
while (repeat) 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); repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN);
// Map 32 results into one KPKBitbase[] entry // Map 32 results into one KPKBitbase[] entry
for (idx = 0; idx < IndexMax; ++idx) for (idx = 0; idx < MAX_INDEX; ++idx)
if (db[idx] == WIN) if (db[idx] == WIN)
KPKBitbase[idx / 32] |= 1 << (idx & 0x1F); KPKBitbase[idx / 32] |= 1 << (idx & 0x1F);
} }

View file

@ -51,11 +51,11 @@ namespace Time {
template<class Entry, int Size> template<class Entry, int Size>
struct HashTable { struct HashTable {
HashTable() : e(Size, Entry()) {} HashTable() : table(Size, Entry()) {}
Entry* operator[](Key k) { return &e[(uint32_t)k & (Size - 1)]; } Entry* operator[](Key k) { return &table[(uint32_t)k & (Size - 1)]; }
private: private:
std::vector<Entry> e; std::vector<Entry> table;
}; };

View file

@ -46,10 +46,10 @@ namespace {
assert(!pos.checkers()); assert(!pos.checkers());
const int K = Chess960 ? kto > kfrom ? -1 : 1 const Square K = Chess960 ? kto > kfrom ? DELTA_W : DELTA_E
: Side == KING_SIDE ? -1 : 1; : 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) if (pos.attackers_to(s) & enemies)
return mlist; return mlist;

View file

@ -210,10 +210,10 @@ void MovePicker::score<EVASIONS>() {
} }
/// generate_next() generates, scores and sorts the next bunch of moves, when /// generate_next_stage() generates, scores and sorts the next bunch of moves,
/// there are no more moves to try for the current phase. /// when there are no more moves to try for the current stage.
void MovePicker::generate_next() { void MovePicker::generate_next_stage() {
cur = moves; cur = moves;
@ -305,7 +305,7 @@ Move MovePicker::next_move<false>() {
while (true) while (true)
{ {
while (cur == end) while (cur == end)
generate_next(); generate_next_stage();
switch (stage) { switch (stage) {

View file

@ -92,7 +92,7 @@ public:
private: private:
template<GenType> void score(); template<GenType> void score();
void generate_next(); void generate_next_stage();
const Position& pos; const Position& pos;
const HistoryStats& history; const HistoryStats& history;

View file

@ -98,6 +98,7 @@ const int MAX_PLY_PLUS_6 = MAX_PLY + 6;
/// bit 6-11: origin square (from 0 to 63) /// bit 6-11: origin square (from 0 to 63)
/// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2) /// 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) /// 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 /// 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 /// 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. /// standard compliant, seems to work for Intel and MSVC.
#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER)) #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 #else
inline Value eg_value(Score s) { 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 #endif
@ -295,7 +296,7 @@ ENABLE_OPERATORS_ON(Square)
ENABLE_OPERATORS_ON(File) ENABLE_OPERATORS_ON(File)
ENABLE_OPERATORS_ON(Rank) 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); }
inline Value operator-(Value v, int i) { return Value(int(v) - i); } inline Value operator-(Value v, int i) { return Value(int(v) - i); }