What's mobility worth in your engine?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
algerbrex
Posts: 608
Joined: Sun May 30, 2021 5:03 am
Location: United States
Full name: Christian Dean

What's mobility worth in your engine?

Post by algerbrex »

In my refactoring of Blunder, I'm now at the point where I want to re-visit my mobility scheme. From looking at my logs, my original implementation netted ~30 Elo in self-play when I tested. It's a very basic setup, where the number of moves for each piece is counted, roughly averaged, and then multiplied by a fixed bonus per type. This sort of scheme wasn't always great though at accurately judging the mobility of a position, so I'm working on some different ideas to encode more mobility knowledge into the engine.

I'm curious what other engines are gaining in terms of mobility in their evaluation functions. I'd like to use these answers as a rough metric of how much effort to devote for now into improving evaluation.

Of course, for engines like OliThink, I know this number will be skewed to be quite a bit higher :)
User avatar
emadsen
Posts: 440
Joined: Thu Apr 26, 2012 1:51 am
Location: Oak Park, IL, USA
Full name: Erik Madsen

Re: What's mobility worth in your engine?

Post by emadsen »

At the time I added piece mobility to MadChess, I got 62 Elo, as measured in a gauntlet tournament against ten other engines at 2+1 time control.
Erik Madsen | My C# chess engine: https://www.madchess.net
KhepriChess
Posts: 93
Joined: Sun Aug 08, 2021 9:14 pm
Full name: Kurt Peters

Re: What's mobility worth in your engine?

Post by KhepriChess »

Mine was something like less than 30. I just simply counted the number of attacks a piece had and grabbed a bonus value from an array. Biggest issue with that for me is that counting bits is slow in JS (there's no built-in method to do so).
Puffin: Github
KhepriChess: Github
clayt
Posts: 29
Joined: Thu Jun 09, 2022 5:09 am
Full name: Clayton Ramsey

Re: What's mobility worth in your engine?

Post by clayt »

KhepriChess wrote: Sat Mar 25, 2023 6:07 pm Mine was something like less than 30. I just simply counted the number of attacks a piece had and grabbed a bonus value from an array. Biggest issue with that for me is that counting bits is slow in JS (there's no built-in method to do so).
I took a look at your implementation of popcnt in KhepriChess and found that you could make it a little faster. Right now you're using the SWAR algorithm for 32-bit integers and adding it together. You can roughly double your performance by moving to the 64-bit version of the algorithm here: https://www.chessprogramming.org/Popula ... t#popCount
KhepriChess
Posts: 93
Joined: Sun Aug 08, 2021 9:14 pm
Full name: Kurt Peters

Re: What's mobility worth in your engine?

Post by KhepriChess »

clayt wrote: Sun Mar 26, 2023 10:06 pm
KhepriChess wrote: Sat Mar 25, 2023 6:07 pm Mine was something like less than 30. I just simply counted the number of attacks a piece had and grabbed a bonus value from an array. Biggest issue with that for me is that counting bits is slow in JS (there's no built-in method to do so).
I took a look at your implementation of popcnt in KhepriChess and found that you could make it a little faster. Right now you're using the SWAR algorithm for 32-bit integers and adding it together. You can roughly double your performance by moving to the 64-bit version of the algorithm here: https://www.chessprogramming.org/Popula ... t#popCount
I've actually spent quite a lot of time testing various popcount methods and so far what I'm using is the fastest that I've found. I did just retry the method you linked to (which I'm sure I've tried before, but I've lost track at this point) but it's a -118.6 +/- 42.0 change.

Part of the reason is how JS does BigInts: They're "arbitrary-precision integers" and not actual 64-bit integers so JS stores them as objects in memory. And when it does BigInt arithmetic, like multiplication (as that algorithm) does, it actually has to multiply each digit and sum the results (as you would if you were manually multiplying two numbers like it's taught in school). It's stupid slow.
Puffin: Github
KhepriChess: Github