Killer moves

Discussion of chess software programming and technical issues.

Moderator: Ras

AngularMomentum
Posts: 18
Joined: Mon Apr 10, 2023 6:33 am
Full name: Jayden Joo

Killer moves

Post by AngularMomentum »

I'm new to chess programmming so excuse me if I'm making a dumb comment. I implemented killer moves with two slots for each ply 'poorly' the first time, using the first slot only if it was empty and put my moves in the second slot otherwise(assuming the move isn't equal to the one in the first). Then I made a 'better' implementation that alternated between the first and the second slot (assuming the move wasn't already stored in the other slot). However, the second implementation which should have produced a better result actually performed worse. Is this what's supposed to happen?
gaard
Posts: 463
Joined: Mon Jun 07, 2010 3:13 am
Location: Holland, MI
Full name: Martin W

Re: Killer moves

Post by gaard »

AngularMomentum wrote: Sun Apr 16, 2023 4:42 pm I'm new to chess programmming so excuse me if I'm making a dumb comment. I implemented killer moves with two slots for each ply 'poorly' the first time, using the first slot only if it was empty and put my moves in the second slot otherwise(assuming the move isn't equal to the one in the first). Then I made a 'better' implementation that alternated between the first and the second slot (assuming the move wasn't already stored in the other slot). However, the second implementation which should have produced a better result actually performed worse. Is this what's supposed to happen?
The difference should be negligible, probably none at all, unless you are scoring them wildly different in your move ordering. What are your match statistics?
AngularMomentum
Posts: 18
Joined: Mon Apr 10, 2023 6:33 am
Full name: Jayden Joo

Re: Killer moves

Post by AngularMomentum »

gaard wrote: Sun Apr 16, 2023 5:45 pm
AngularMomentum wrote: Sun Apr 16, 2023 4:42 pm I'm new to chess programmming so excuse me if I'm making a dumb comment. I implemented killer moves with two slots for each ply 'poorly' the first time, using the first slot only if it was empty and put my moves in the second slot otherwise(assuming the move isn't equal to the one in the first). Then I made a 'better' implementation that alternated between the first and the second slot (assuming the move wasn't already stored in the other slot). However, the second implementation which should have produced a better result actually performed worse. Is this what's supposed to happen?
The difference should be negligible, probably none at all, unless you are scoring them wildly different in your move ordering. What are your match statistics?
Do I have to have test matches for move ordering? I simply tested node counts for a given depth on a bunch of test positions and there seemed to be about 5% difference of the node counts. My match stastics aren't very meaningful since I don't have any pruning techniques or opening books so nearly all games play out the same way.
gaard
Posts: 463
Joined: Mon Jun 07, 2010 3:13 am
Location: Holland, MI
Full name: Martin W

Re: Killer moves

Post by gaard »

AngularMomentum wrote: Mon Apr 17, 2023 12:30 am
gaard wrote: Sun Apr 16, 2023 5:45 pm
AngularMomentum wrote: Sun Apr 16, 2023 4:42 pm I'm new to chess programmming so excuse me if I'm making a dumb comment. I implemented killer moves with two slots for each ply 'poorly' the first time, using the first slot only if it was empty and put my moves in the second slot otherwise(assuming the move isn't equal to the one in the first). Then I made a 'better' implementation that alternated between the first and the second slot (assuming the move wasn't already stored in the other slot). However, the second implementation which should have produced a better result actually performed worse. Is this what's supposed to happen?
The difference should be negligible, probably none at all, unless you are scoring them wildly different in your move ordering. What are your match statistics?
Do I have to have test matches for move ordering? I simply tested node counts for a given depth on a bunch of test positions and there seemed to be about 5% difference of the node counts. My match stastics aren't very meaningful since I don't have any pruning techniques or opening books so nearly all games play out the same way.
Match statistics are what ultimately must be used to determine if a change is better or worse. Many testing frameworks, like cutechess for example, let you use opening positions to get more variety in gameplay. https://www.sp-cc.de/uho_2022.htm is a great resource for starting positions.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Killer moves

Post by hgm »

As long as you don't do move-order-dependent pruning or reduction, time-to-depth should be a meaningful measure for performance. Provided the test positions are a representative example of what you would encounter in games. (So not puzzle positions from test suites intended to measure human player strength!) Positions randomly selected from games would be good enough.

If your do pruning in a move-order-dependent way, then it is not so clear cut. An alternative ordering could be faster just because it led to more pruning, but with the pruned part part of the strength might have gone away too. By testing with games you won't have that problem.