Code: Select all
assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
e5 and e6, then this assert would fail. What I'm missing? Thank you.
Moderators: hgm, Rebel, chrisw
Code: Select all
assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
Only the pawn on e6 is counted as a passed pawn, because the other one can't make progress on its own. (You could still count it as passed but it would get very little points if it does not have a cleared square in front of it and if blocked, the other passed pawn apparently also can't make progress so together they would get probably too much if both are counted as normal passed pawns).Necromancer wrote:Quick question...while studying sf's passed pawns code, we see this at evaluate.cpp line 625:
I don't understand this asssertion. Suppose white has passed pawns onCode: Select all
assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
e5 and e6, then this assert would fail. What I'm missing? Thank you.
I thought about that, but what about the assert call? From what I saw both pawns would be set on the passed pawn bitboard.Eelco de Groot wrote:Only the pawn on e6 is counted as a passed pawn, because the other one can't make progress on its own. (You could still count it as passed but it would get very little points if it does not have a cleared square in front of it and if blocked, the other passed pawn apparently also can't make progress so together they would get probably too much if both are counted as normal passed pawns).Necromancer wrote:Quick question...while studying sf's passed pawns code, we see this at evaluate.cpp line 625:
I don't understand this asssertion. Suppose white has passed pawns onCode: Select all
assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
e5 and e6, then this assert would fail. What I'm missing? Thank you.
Code: Select all
// Passed pawns will be properly scored in evaluation because we need
// full attack info to evaluate them.
if (!stoppers && !(ourPawns & forward_bb(Us, s)))
e->passedPawns[Us] |= s;
"couple of" = zero, since assertions are not used in the release version (removed at compile time), and the performance of the debug version is irrelevant.Lyudmil Tsvetkov wrote:advanced programmers' code seems to be an enigma to mere mortals.
with asserts, it is more or less clear: you waste couple of microseconds on an assert check to only be sure the definition is correct.
You can't grasp that since you will never see that in correct C++ codeLyudmil Tsvetkov wrote:what I can not grasp entirely, however, is why they first construct some classes, and then immediately after that destroy them:
class class1; ~class1();
Lyudmil Tsvetkov wrote:maybe it has to do with memory allocation and releasing memory at the appropriate time, but, no matter how hard I try, the concept is utterly beyond me.
maybe one day I will understand...
Code: Select all
assert(No_you_won_t);
thanks for the explanation, Sven!Sven Schüle wrote:"couple of" = zero, since assertions are not used in the release version (removed at compile time), and the performance of the debug version is irrelevant.
that is what I rememebr from SF code. maybe I missed to mention that it was executed as a virtual function within the class, or something else of the kind, which I do not quite understand one way or another. not as easy as malloc, realloc and free.Sven Schüle wrote: You can't grasp that since you will never see that in correct C++ code
man, I tried it, and assertion failed.Sven Schüle wrote:Code: Select all
assert(No_you_won_t);