Page 1 of 1

Qsearch of Stockfish 1.7.1

Posted: Thu May 13, 2010 8:33 pm
by Ferdy
There could be a bug in updating oldAlpha.
At the top of it there is oldAlpha = alpha, at the middle there is a possibility that alpha will be updated with staticValue or bestValue, if it happens then oldAlpha will now be wrong.
At the end saving of tt info. will be affected.

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 9:11 am
by zamar
There is no bug.

oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 2:07 pm
by QED
Joona Kiiski wrote:oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 2:51 pm
by zamar
QED wrote:
Joona Kiiski wrote:oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?
From compiler's point of view this would definitely be better, but I don't know if it is harder to read for a human? I'll discuss about this with Marco.

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 4:05 pm
by QED
Joona Kiiski wrote:
QED wrote:
Joona Kiiski wrote:oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?
From compiler's point of view this would definitely be better, but I don't know if it is harder to read for a human? I'll discuss about this with Marco.
Another possibiliy would be "const Value alpha" for the argument, and "Value newAlpha" for the variable.

I am new to serious chess programming, so I am not sure which is more readable.

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 6:03 pm
by mcostalba
QED wrote:
Joona Kiiski wrote:
QED wrote:
Joona Kiiski wrote:oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?
From compiler's point of view this would definitely be better, but I don't know if it is harder to read for a human? I'll discuss about this with Marco.
Another possibiliy would be "const Value alpha" for the argument, and "Value newAlpha" for the variable.

I am new to serious chess programming, so I am not sure which is more readable.
In chess programming is a well estabilished convention to call the search functions passing as arguments: 'alpha' and 'beta'

So I would not change that well understood and general convention used almost always in literature when talking about alpha-beta search.

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 6:07 pm
by Ferdy
zamar wrote:There is no bug.

oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
The thing I see under current scheme is that, ss[ply].pv[ply] can not guarantee to contain a move :o

Code: Select all

 TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, d, ss[ply].pv[ply]);

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 6:10 pm
by mcostalba
Ferdy wrote:
zamar wrote:There is no bug.

oldAlpha as the name puts it is "original alpha", this is initialized in the beginning of the qsearch and must not be changed at any point :)
The thing I see under current scheme is that, ss[ply].pv[ply] can not guarantee to contain a move :o

Code: Select all

 TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, d, ss[ply].pv[ply]);
So ? :o

Re: Qsearch of Stockfish 1.7.1

Posted: Fri May 14, 2010 7:00 pm
by Teemu Pudas
It's supposed to contain a move if and only if at least one of the moves is better than standing pat.

Re: Qsearch of Stockfish 1.7.1

Posted: Sat May 15, 2010 11:19 pm
by zamar
When we initialize a node we set (see SearchStack::init()):

pv[ply] = pv[ply + 1] = MOVE_NONE;

So if there is a move better than stand pat score it'll be saved in TT. If not we call TT.store(move=MOVE_NONE) which means that old move won't be overwritten. I can see no problem with current behaviour. Am I missing sth?