Qsearch of Stockfish 1.7.1

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Ferdy
Posts: 4109
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Qsearch of Stockfish 1.7.1

Post by Ferdy » Thu May 13, 2010 6:33 pm

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 6:03 am

Re: Qsearch of Stockfish 1.7.1

Post by zamar » Fri May 14, 2010 7:11 am

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 8:53 pm

Re: Qsearch of Stockfish 1.7.1

Post by QED » Fri May 14, 2010 12:07 pm

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 6:03 am

Re: Qsearch of Stockfish 1.7.1

Post by zamar » Fri May 14, 2010 12:51 pm

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 8:53 pm

Re: Qsearch of Stockfish 1.7.1

Post by QED » Fri May 14, 2010 2:05 pm

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 7:17 pm

Re: Qsearch of Stockfish 1.7.1

Post by mcostalba » Fri May 14, 2010 4:03 pm

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: 4109
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Qsearch of Stockfish 1.7.1

Post by Ferdy » Fri May 14, 2010 4:07 pm

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 7:17 pm

Re: Qsearch of Stockfish 1.7.1

Post by mcostalba » Fri May 14, 2010 4:10 pm

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 11:49 am

Re: Qsearch of Stockfish 1.7.1

Post by Teemu Pudas » Fri May 14, 2010 5:00 pm

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 6:03 am

Re: Qsearch of Stockfish 1.7.1

Post by zamar » Sat May 15, 2010 9:19 pm

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

Post Reply