Qsearch of Stockfish 1.7.1

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Qsearch of Stockfish 1.7.1

Post 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.
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: Qsearch of Stockfish 1.7.1

Post 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 :)
Joona Kiiski
QED
Posts: 60
Joined: Thu Nov 05, 2009 9:53 pm

Re: Qsearch of Stockfish 1.7.1

Post 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"?
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: Qsearch of Stockfish 1.7.1

Post 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.
Joona Kiiski
QED
Posts: 60
Joined: Thu Nov 05, 2009 9:53 pm

Re: Qsearch of Stockfish 1.7.1

Post 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.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Qsearch of Stockfish 1.7.1

Post 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.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Qsearch of Stockfish 1.7.1

Post 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]);
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Qsearch of Stockfish 1.7.1

Post 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
Teemu Pudas
Posts: 88
Joined: Wed Mar 25, 2009 12:49 pm

Re: Qsearch of Stockfish 1.7.1

Post 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.
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: Qsearch of Stockfish 1.7.1

Post 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?
Joona Kiiski