Compare commits

..

6 Commits

Author SHA1 Message Date
Marco Costalba
e3b23eb818 Stockfish 2.1.1
stockfish bench signature is: 6487630

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-05-08 08:46:33 +01:00
Marco Costalba
d494725400 Spell fix in evaluate.cpp
Spotted by Eelco.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-05-07 10:08:53 +01:00
Marco Costalba
2535dc1340 Fix reading of book file
Bug is subtle because appears only under MSVC 32 bits in
optimized version, hence was missed before.

Bug is due to the fact that evaluation order of terms of a
sum is undefined by the standard, so in get_int() we have:

return 256 * get_int<n-1>() + bookFile.get();

And if get() is evaluated before get_int() we have a corrupted
key.

The patch rewrites the code in a more natural and predictable way.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-05-07 09:51:33 +01:00
Marco Costalba
339bf9b7e1 Remove redundant assignment in search()
It is already assigned few lines before.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-05-05 12:16:26 +01:00
Marco Costalba
bb86691a0d Restore development version
No functional change.
2011-05-05 06:35:42 +01:00
Marco Costalba
f7fee4c616 Fix a warning in debug mode
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-05-03 19:29:21 +01:00
5 changed files with 22 additions and 17 deletions

View File

@@ -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
/// 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);
*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())
{

View File

@@ -48,12 +48,7 @@ public:
const std::string name() const { return bookName; }
private:
// read n chars from the file stream and converts them in an
// 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; }
template<typename T> void get_number(T& n);
BookEntry read_entry(int idx);
int find_entry(uint64_t key);
@@ -64,8 +59,4 @@ private:
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)

View File

@@ -142,9 +142,9 @@ namespace {
{ 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.
const Score ThreatedByPawnPenalty[] = {
const Score ThreatenedByPawnPenalty[] = {
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
// of threat evaluation must be done later when we have full attack info.
if (bit_is_set(ei.attackedBy[Them][PAWN], s))
score -= ThreatedByPawnPenalty[Piece];
score -= ThreatenedByPawnPenalty[Piece];
// Bishop and knight outposts squares
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
// is not in check. So only friendly pieces can be blockers.
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
movesToGo += count_1s<Max15>(queeningPath & pos.pieces_of_color(c));

View File

@@ -54,7 +54,7 @@ using namespace std;
/// current date (in the format YYMMDD) is used as a version number.
static const string AppName = "Stockfish";
static const string EngineVersion = "2.1";
static const string EngineVersion = "2.1.1";
static const string AppTag = "";

View File

@@ -1067,7 +1067,6 @@ split_point_start: // At split points actual search starts from here
ss->reduction = reduction<PvNode>(depth, moveCount);
if (ss->reduction)
{
alpha = SpNode ? sp->alpha : alpha;
Depth d = newDepth - ss->reduction;
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d);