mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 09:47:46 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e3b23eb818 | |||
| d494725400 | |||
| 2535dc1340 | |||
| 339bf9b7e1 | |||
| bb86691a0d | |||
| f7fee4c616 |
+16
-1
@@ -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())
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-10
@@ -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)
|
||||||
|
|||||||
+4
-4
@@ -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))
|
||||||
@@ -924,7 +924,7 @@ namespace {
|
|||||||
// Opponent king cannot block because path is defended and position
|
// Opponent king cannot block because path is defended and position
|
||||||
// is not in check. So only friendly pieces can be blockers.
|
// is not in check. So only friendly pieces can be blockers.
|
||||||
assert(!pos.in_check());
|
assert(!pos.in_check());
|
||||||
assert(queeningPath & pos.occupied_squares() == queeningPath & pos.pieces_of_color(c));
|
assert((queeningPath & pos.occupied_squares()) == (queeningPath & pos.pieces_of_color(c)));
|
||||||
|
|
||||||
// Add moves needed to free the path from friendly pieces and retest condition
|
// Add moves needed to free the path from friendly pieces and retest condition
|
||||||
movesToGo += count_1s<Max15>(queeningPath & pos.pieces_of_color(c));
|
movesToGo += count_1s<Max15>(queeningPath & pos.pieces_of_color(c));
|
||||||
|
|||||||
+1
-1
@@ -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 = "";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1067,7 +1067,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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user