Rustic vs. Shallow Blue: one of us is weird somehow

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Ras
Posts: 2485
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by Ras »

hgm wrote: Sat Oct 31, 2020 9:09 amMy engines usually do IID, so I cannot just increase the alpha that was passed to them
Isn't the IID before the actual move loop (where alpha gets modified) to get the probably best move to the top of the list?

Though, after looking again, I see that I do need the start_alpha: for maintaining the hash tables once the node's move loop is over. That's different depending on whether any move has improved alpha or not.
mvanthoor wrote: Sat Oct 31, 2020 1:37 pmMany engines have a "best_move" in the global space.
I'm passing the move list by reference to the recursive function, and the best move index also as reference. This move list may be either filled for "early" move generation (such as root and check evasions), or empty for "late" and for "even later" move generation. The best move index is initialised to -1, and if it's still at -1 afterwards, this means that no best move was found. Either because all moves failed low, or because the position doesn't have legal moves.

Now the trick is that the recursive function itself declares a move list and a best move index, which is what it hands over to the next recursion level.
Rasmus Althoff
https://www.ct800.net
User avatar
hgm
Posts: 27700
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by hgm »

Ras wrote: Sat Oct 31, 2020 3:47 pmIsn't the IID before the actual move loop (where alpha gets modified) to get the probably best move to the top of the list?
The IID is the move loop. That is, each iteration must loop over moves. Of course one iteration comes before the next, and puts its best move at the top of the list for the latter.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by mvanthoor »

Ras wrote: Sat Oct 31, 2020 3:47 pm Though, after looking again, I see that I do need the start_alpha: for maintaining the hash tables once the node's move loop is over. That's different depending on whether any move has improved alpha or not.
If I ever need to know "has alpha actually improved after I did x or y?" I can always reintroduce start_alpha. For now, I don't need it, so I removed it. I very much dislike unused or unnecessary code in my programs; after it sits there for some time and basically does nothing, it confuses me when I go back to it later.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Ras
Posts: 2485
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by Ras »

hgm wrote: Sat Oct 31, 2020 4:37 pmThe IID is the move loop.
As I understand it, that's not the IID, but just the main ID?
Rasmus Althoff
https://www.ct800.net
User avatar
hgm
Posts: 27700
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by hgm »

Well, ID is just IID in the root. With IID you also do that in 'internal' nodes of the tree.
Ras
Posts: 2485
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by Ras »

hgm wrote: Sat Oct 31, 2020 10:53 pmWell, ID is just IID in the root. With IID you also do that in 'internal' nodes of the tree.
I think it's quite different in that the IID is rather a shallow pre-search (before the node move loop) if no PV move and no hash move are available. From the CPW:
IID is used to find a good move to search first by searching the current position to a reduced depth, and using the best move of that search as the first move at the real depth.
Rasmus Althoff
https://www.ct800.net
User avatar
hgm
Posts: 27700
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Rustic vs. Shallow Blue: one of us is weird somehow

Post by hgm »

But that is exactly the same in the root. You start at d=1 there too, to get a better move for starting the d=2 search, etc. Otherwise you might as well have started at the depth you reached in your previous turn, or perhaps one ply less deep to play it safe.

What you call a 'pre-search before the move loop' in fact involves a completely identical move loop. It is just another iteration of the depth loop that surrounds the move loop. Whether that depth loop addresses every depth up to the requested one, skips every other depth, or only tries two depths is just an implementation detail.