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.
Qsearch of Stockfish 1.7.1
Moderator: Ras
-
- Posts: 4845
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: Qsearch of Stockfish 1.7.1
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
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

Joona Kiiski
-
- Posts: 60
- Joined: Thu Nov 05, 2009 9:53 pm
Re: Qsearch of Stockfish 1.7.1
Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?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 :)
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: Qsearch of Stockfish 1.7.1
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.QED wrote:Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?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
Joona Kiiski
-
- Posts: 60
- Joined: Thu Nov 05, 2009 9:53 pm
Re: Qsearch of Stockfish 1.7.1
Another possibiliy would be "const Value alpha" for the argument, and "Value newAlpha" for the variable.Joona Kiiski wrote: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.QED wrote:Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?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 :)
I am new to serious chess programming, so I am not sure which is more readable.
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: Qsearch of Stockfish 1.7.1
In chess programming is a well estabilished convention to call the search functions passing as arguments: 'alpha' and 'beta'QED wrote:Another possibiliy would be "const Value alpha" for the argument, and "Value newAlpha" for the variable.Joona Kiiski wrote: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.QED wrote:Then why there is "Value alpha" as an argument of qsearch(), and not "const Value oldAlpha"?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
I am new to serious chess programming, so I am not sure which is more readable.
So I would not change that well understood and general convention used almost always in literature when talking about alpha-beta search.
-
- Posts: 4845
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: Qsearch of Stockfish 1.7.1
The thing I see under current scheme is that, ss[ply].pv[ply] can not guarantee to contain a movezamar 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

Code: Select all
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, d, ss[ply].pv[ply]);
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: Qsearch of Stockfish 1.7.1
So ?Ferdy wrote:The thing I see under current scheme is that, ss[ply].pv[ply] can not guarantee to contain a movezamar 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![]()
Code: Select all
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, d, ss[ply].pv[ply]);

-
- Posts: 88
- Joined: Wed Mar 25, 2009 12:49 pm
Re: Qsearch of Stockfish 1.7.1
It's supposed to contain a move if and only if at least one of the moves is better than standing pat.
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: Qsearch of Stockfish 1.7.1
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?
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?
Joona Kiiski