Implementing Contempt For The Draw
Moderators: hgm, Rebel, chrisw
-
- Posts: 15
- Joined: Thu Jul 25, 2019 7:13 pm
- Full name: Jay Warendorff
Implementing Contempt For The Draw
I am writing a C language chess engine using FirstChess as a base. Please provide some insight on how to implement Contempt For The Draw in the code.
-
- Posts: 96
- Joined: Fri Jul 06, 2018 1:09 am
- Location: Chicago, IL
- Full name: Josh Odom
Re: Implementing Contempt For The Draw
It doesn't look like FirstChess will evaluate a draw for repetition or 50 move rule, so it will actually blindly stumble into those without realizing they terminate the game. The only draw FirstChess can see is stalemate, which I see on line 623.
For contempt, there are 2 things to take into account.
However, within a negamax search, score is always given from the perspective of the side being evaluated (so if it's black's turn, a positive value means black's winning). So, if the engine is playing as white, and black gets stalemated, then it needs to be evaluated as +20 centipawns.
For contempt, there are 2 things to take into account.
- The draw value changes sign depending on which color the engine is playing as.
- Since Search() is negamax, draw value also changes sign depending on which color is currently being evaluated.
However, within a negamax search, score is always given from the perspective of the side being evaluated (so if it's black's turn, a positive value means black's winning). So, if the engine is playing as white, and black gets stalemated, then it needs to be evaluated as +20 centipawns.