Help with Search

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

oriyonay
Posts: 32
Joined: Tue Jun 01, 2021 5:46 am
Full name: ori yonay

Help with Search

Post by oriyonay »

Hi there - I hope you're having a beautiful day so far!
I've been writing my engine, and it plays decent chess for an engine that just has basic evaluation, aspiration windows, killer/history heuristics, null move pruning, transposition tables, check extension, LMR, qsearch, and PVS. It can evaluate ~3mnps, yet still gets consistently beaten by VICE even though from my understanding most engines with these features can easily play at > 2000 elo while evaluating far fewer nodes. Is there anything I'm missing or could do to easily improve this? I'm open to any feedback/suggestions you have :)

For your reference, here's my search code :)

Thank you so much!! Have a fantastic rest of your day!
- Ori
AndrewGrant
Posts: 1750
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Help with Search

Post by AndrewGrant »

1. Looks like your history counters could get pretty crazy. Looks like you only give bonuses and never maluses? And it goes up infinity, and far eclipses your other metrics in score_move for sorting.

2. I also question your TT storages, as it looks to me from negamax() that you always store "EXACT" values.

3. It also looks like you will overwrite your killers, such that you store the same one in both places.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Help with Search

Post by mvanthoor »

oriyonay wrote: Wed Aug 04, 2021 5:45 am Hi there - I hope you're having a beautiful day so far!
I've been writing my engine, and it plays decent chess for an engine that just has basic evaluation, aspiration windows, killer/history heuristics, null move pruning, transposition tables, check extension, LMR, qsearch, and PVS. It can evaluate ~3mnps, yet still gets consistently beaten by VICE even though from my understanding most engines with these features can easily play at > 2000 elo while evaluating far fewer nodes. Is there anything I'm missing or could do to easily improve this? I'm open to any feedback/suggestions you have :)

For your reference, here's my search code :)

Thank you so much!! Have a fantastic rest of your day!
- Ori
First, you don't need all of those features to be able to beat VICE. The things you need are:

- Board representation and search obviously.
- Check extension
- QSearch
- MVV-LVA
- A transposition table

At that point, your engine should already be over 1800.

Then when you add a tapered evaluation with good PST's, you should be on par with VICE, or at least over 2000 (depending on the speed of your engine). If you have PVS + Killer moves in addition to the above, your engine should be about +100 against VICE (CCRL Blitz 2150 Elo.)

I'm going by my own experience with Rustic. The current development version has the features above, but NOT null move, LMR, aspiration windows, or history heuristics, and it's consistently +100 Elo stronger than VICE.

So, my suggestion would be to strip all features from your engine, and add them back in one by one, testing how much strength you earn per feature. You can see what Rustic gained, here:

https://rustic-chess.org/progress/sprt_results.html

(In self-play, so the real gains are somewhat lower, but you have a basis for comparison.)

Also take AndrewGrant's suggestions into account. I'm sure the points he mentioned either cause you to not gain Elo while having the feature, or maybe worse, lose Elo by implementing the feature like you did.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
oriyonay
Posts: 32
Joined: Tue Jun 01, 2021 5:46 am
Full name: ori yonay

Re: Help with Search

Post by oriyonay »

THANK YOU BOTH FOR YOUR HELP! I really appreciate it!
I found the very small bug using the method Marcel suggested (I had various versions of my engine, each without some feature, against each other, and figured out where the bug was that way) and my engine now beats VICE 10-0 and plays at around 2450 ELO :)

Thank you so much!!!
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Help with Search

Post by mvanthoor »

oriyonay wrote: Thu Aug 05, 2021 11:01 pm THANK YOU BOTH FOR YOUR HELP! I really appreciate it!
I found the very small bug using the method Marcel suggested (I had various versions of my engine, each without some feature, against each other, and figured out where the bug was that way) and my engine now beats VICE 10-0 and plays at around 2450 ELO :)

Thank you so much!!!
You're welcome. So, what was the bug?
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
oriyonay
Posts: 32
Joined: Tue Jun 01, 2021 5:46 am
Full name: ori yonay

Re: Help with Search

Post by oriyonay »

mvanthoor wrote: Fri Aug 06, 2021 12:59 pm You're welcome. So, what was the bug?
When I was checking the conditions for null move pruning, I checked the move history list (just a list of all the moves that have been played) to make sure the last move played was not NULL, but I checked the entry [ply] instead of entry [ply-1].

It's the smallest things that make a huge difference in chess engines!!!

Again, I appreciate all your help, and am a huge fan of both Rustic and Ethereal!