Implementing Contempt For The Draw
Moderators: hgm, Dann Corbit, Harvey Williamson
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
-
- Posts: 13
- Joined: Thu Jul 25, 2019 5: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.
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.