Evaluating underpromotions leading to unusual sets of pieces on the board

Discussion of chess software programming and technical issues.

Moderator: Ras

osvitashev
Posts: 13
Joined: Tue Sep 07, 2021 6:17 pm
Full name: Alex S

Evaluating underpromotions leading to unusual sets of pieces on the board

Post by osvitashev »

I am currently in the process of writing a static exchange evaluation routine for my bitboard-based chess engine. My plan is to use same routine to assess square control and space in the main evaluation function.
I have found myself going down the rabbit hole of trying to account for some increasingly unlikely edge cases: chess rules do not make it impossible for a player to have three knights or two bishops of the same color. Such positions require underpromotions as well as not doing for material exchanges. Obviously, positions like that are arcanely rare in real games, but they could be encountered during the search.
It feels excessive to have to introduce extra code complexity in order to account for something so extremely unlikely, but at the same time i am worried about introducing bias to my routine.

Perhaps a more generic version of my question would be: when is it permissible to make the engine blind to certain positional features in order to simplify it and speed up the evaluation?
User avatar
hgm
Posts: 28395
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Evaluating underpromotions leading to unusual sets of pieces on the board

Post by hgm »

If you simply make the engine resign when the side to move has more than 2 R or N, or same-colored B, you would lose 0 Elo...