Question about Countermoves

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Question about Countermoves

Post by eboatwright »

Hello,

I currently have History and (2) Killer moves implemented in my engine, but I stumbled upon Countermoves on the Wiki.
They all get updated on a beta-cutoff, so seems like the same thing? Is it supposed to be used together with the others, or is it an alternative?

I'm currently setting up tests to see how it works together with my engine, but I wanted to post here to see if anybody else has some insight

Thanks in advance!
Creator of Maxwell
gaard
Posts: 462
Joined: Mon Jun 07, 2010 3:13 am
Location: Holland, MI
Full name: Martin W

Re: Question about Countermoves

Post by gaard »

eboatwright wrote: Sat Jan 27, 2024 7:14 pm Hello,

I currently have History and (2) Killer moves implemented in my engine, but I stumbled upon Countermoves on the Wiki.
They all get updated on a beta-cutoff, so seems like the same thing? Is it supposed to be used together with the others, or is it an alternative?

I'm currently setting up tests to see how it works together with my engine, but I wanted to post here to see if anybody else has some insight

Thanks in advance!
History generally tracks only to-from for stm, while counters use previous move piece-to, so you're getting a little more information with the cutoff. Some engines use piece-to as history but even then counters should still add useful information... since neither history or killers use the previous move it is beneficial with or without them. After running a super fast match with and without counter moves (and both with history and killers), counter moves easily yields 10+ Elo in my engine. For 10ish lines of code, it's a must-have.
User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Re: Question about Countermoves

Post by eboatwright »

gaard wrote: Sat Jan 27, 2024 8:50 pm
eboatwright wrote: Sat Jan 27, 2024 7:14 pm Hello,

I currently have History and (2) Killer moves implemented in my engine, but I stumbled upon Countermoves on the Wiki.
They all get updated on a beta-cutoff, so seems like the same thing? Is it supposed to be used together with the others, or is it an alternative?

I'm currently setting up tests to see how it works together with my engine, but I wanted to post here to see if anybody else has some insight

Thanks in advance!
History generally tracks only to-from for stm, while counters use previous move piece-to, so you're getting a little more information with the cutoff. Some engines use piece-to as history but even then counters should still add useful information... since neither history or killers use the previous move it is beneficial with or without them. After running a super fast match with and without counter moves (and both with history and killers), counter moves easily yields 10+ Elo in my engine. For 10ish lines of code, it's a must-have.
Thank you so much!

I'll try that with my engine, although my engine's history indexes by [piece moved][to], so I'll try switching that around
Creator of Maxwell
User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Re: Question about Countermoves

Post by eboatwright »

Update: I changed my History heuristic to index by [side to move][piece moved from][piece moved to] and that was a decent improvement!
I'm currently running some tests on countermoves (indexed by [piece moved][piece moved to]) but it's not looking good so far
Creator of Maxwell
JacquesRW
Posts: 118
Joined: Sat Jul 30, 2022 12:12 pm
Full name: Jamie Whiting

Re: Question about Countermoves

Post by JacquesRW »

I simplified Counter Moves out a while ago: https://chess.swehosting.se/test/4437/, its probably the case that once you add all the quiet history improvements countermoves are kinda superfluous (after 1-ply conthist in particular).

Also I noticed you use a HashMap for your transposition table: https://github.com/eboatwright/Maxwell/ ... ble.rs#L24
I'd recommend switching to just an array of entries.

Obligatory discord server links (you'll get much faster + better help there):
Engine Programming - https://discord.gg/YctB2p4
Stockfish - https://discord.gg/GWDRS3kU6R
User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Re: Question about Countermoves

Post by eboatwright »

JacquesRW wrote: Fri Feb 02, 2024 8:44 pm I simplified Counter Moves out a while ago: https://chess.swehosting.se/test/4437/, its probably the case that once you add all the quiet history improvements countermoves are kinda superfluous (after 1-ply conthist in particular).
Yeah the test I ran actually showed a decrease in strength, so I think I'll leave it out since I already have Killer moves and History
Also I noticed you use a HashMap for your transposition table: https://github.com/eboatwright/Maxwell/ ... ble.rs#L24
I'd recommend switching to just an array of entries.
At one point I was using a Vec for the transposition table, but I switched back to a HashMap because it's easier haha
I'll try moving it back

Thanks!
Creator of Maxwell