mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
DroidFish: Updated Stockfish engine to version 2.1.1.
This commit is contained in:
parent
629a365d90
commit
ed834bdfbd
|
@ -502,6 +502,18 @@ int Book::find_entry(uint64_t key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Book::get_number() reads sizeof(T) chars from the file's binary byte
|
||||||
|
/// stream and converts them in a number of type T.
|
||||||
|
template<typename T>
|
||||||
|
void Book::get_number(T& n) {
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(T); i++)
|
||||||
|
n = (n << 8) + (T)bookFile.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Book::read_entry() takes an integer index, and returns the BookEntry
|
/// Book::read_entry() takes an integer index, and returns the BookEntry
|
||||||
/// at the given index in the book file.
|
/// at the given index in the book file.
|
||||||
|
|
||||||
|
@ -514,7 +526,10 @@ BookEntry Book::read_entry(int idx) {
|
||||||
|
|
||||||
bookFile.seekg(idx * sizeof(BookEntry), ios_base::beg);
|
bookFile.seekg(idx * sizeof(BookEntry), ios_base::beg);
|
||||||
|
|
||||||
*this >> e.key >> e.move >> e.count >> e.learn;
|
get_number(e.key);
|
||||||
|
get_number(e.move);
|
||||||
|
get_number(e.count);
|
||||||
|
get_number(e.learn);
|
||||||
|
|
||||||
if (!bookFile.good())
|
if (!bookFile.good())
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,12 +48,7 @@ public:
|
||||||
const std::string name() const { return bookName; }
|
const std::string name() const { return bookName; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// read n chars from the file stream and converts them in an
|
template<typename T> void get_number(T& n);
|
||||||
// integer number. Integers are stored with highest byte first.
|
|
||||||
template<int n> uint64_t get_int();
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
Book& operator>>(T& n) { n = (T)get_int<sizeof(T)>(); return *this; }
|
|
||||||
|
|
||||||
BookEntry read_entry(int idx);
|
BookEntry read_entry(int idx);
|
||||||
int find_entry(uint64_t key);
|
int find_entry(uint64_t key);
|
||||||
|
@ -64,8 +59,4 @@ private:
|
||||||
RKISS RKiss;
|
RKISS RKiss;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Yes, we indulge a bit here ;-)
|
|
||||||
template<int n> inline uint64_t Book::get_int() { return 256 * get_int<n-1>() + bookFile.get(); }
|
|
||||||
template<> inline uint64_t Book::get_int<1>() { return bookFile.get(); }
|
|
||||||
|
|
||||||
#endif // !defined(BOOK_H_INCLUDED)
|
#endif // !defined(BOOK_H_INCLUDED)
|
||||||
|
|
|
@ -142,9 +142,9 @@ namespace {
|
||||||
{ S(0, 0), S(15, 39), S(15, 39), S(15, 39), S(15, 39), S( 0, 0) } // QUEEN
|
{ S(0, 0), S(15, 39), S(15, 39), S(15, 39), S(15, 39), S( 0, 0) } // QUEEN
|
||||||
};
|
};
|
||||||
|
|
||||||
// ThreatedByPawnPenalty[PieceType] contains a penalty according to which
|
// ThreatenedByPawnPenalty[PieceType] contains a penalty according to which
|
||||||
// piece type is attacked by an enemy pawn.
|
// piece type is attacked by an enemy pawn.
|
||||||
const Score ThreatedByPawnPenalty[] = {
|
const Score ThreatenedByPawnPenalty[] = {
|
||||||
S(0, 0), S(0, 0), S(56, 70), S(56, 70), S(76, 99), S(86, 118)
|
S(0, 0), S(0, 0), S(56, 70), S(56, 70), S(76, 99), S(86, 118)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ namespace {
|
||||||
// Decrease score if we are attacked by an enemy pawn. Remaining part
|
// Decrease score if we are attacked by an enemy pawn. Remaining part
|
||||||
// of threat evaluation must be done later when we have full attack info.
|
// of threat evaluation must be done later when we have full attack info.
|
||||||
if (bit_is_set(ei.attackedBy[Them][PAWN], s))
|
if (bit_is_set(ei.attackedBy[Them][PAWN], s))
|
||||||
score -= ThreatedByPawnPenalty[Piece];
|
score -= ThreatenedByPawnPenalty[Piece];
|
||||||
|
|
||||||
// Bishop and knight outposts squares
|
// Bishop and knight outposts squares
|
||||||
if ((Piece == BISHOP || Piece == KNIGHT) && pos.square_is_weak(s, Us))
|
if ((Piece == BISHOP || Piece == KNIGHT) && pos.square_is_weak(s, Us))
|
||||||
|
|
|
@ -54,7 +54,7 @@ using namespace std;
|
||||||
/// current date (in the format YYMMDD) is used as a version number.
|
/// current date (in the format YYMMDD) is used as a version number.
|
||||||
|
|
||||||
static const string AppName = "Stockfish";
|
static const string AppName = "Stockfish";
|
||||||
static const string EngineVersion = "2.1";
|
static const string EngineVersion = "2.1.1";
|
||||||
static const string AppTag = "";
|
static const string AppTag = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1068,7 +1068,6 @@ split_point_start: // At split points actual search starts from here
|
||||||
ss->reduction = reduction<PvNode>(depth, moveCount);
|
ss->reduction = reduction<PvNode>(depth, moveCount);
|
||||||
if (ss->reduction)
|
if (ss->reduction)
|
||||||
{
|
{
|
||||||
alpha = SpNode ? sp->alpha : alpha;
|
|
||||||
Depth d = newDepth - ss->reduction;
|
Depth d = newDepth - ss->reduction;
|
||||||
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d);
|
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user