Skip to main content
1 of 4
Hauptideal
  • 6.3k
  • 16
  • 36

Evaluation Function

That measure is called the evaluation function. Each bot can have a different evaluation function depending on how you want it to behave. Will it favour dynamic play or will it play positionally and emphasize pawn structure? If your bot uses a classical evaluation function, these features can be weighted/tuned according to your needs. Here are some examples of features commonly used in classical evaluation functions:

  • Material
  • Pawn Structure
  • Evaluation of Pieces (e.g. good vs bad minor piece)
  • Mobility
  • Center Control
  • King Safety
  • Space

For example, if you want to create a bot that plays aggressively, you might try to make it value material and pawn structure less and mobility and king safety more. You can visit the Chessprogramming Wiki to see more examples and how such features could be measured and implemented. You can also come up with own features such as "trappiness", be creative!

I suggest you use Stockfish, for anything not related to the evaluation (a chess engine also needs a search) and use your own evaluation function, which should be pretty easy to do.

This has already been done, see the SimpleEval bot. Your evaluation function does not even need to be extremely complex to reach acceptable playing strength, as you can see in that extreme example.

You can also try to use a neural network evaluation function. There is research on how to make neural network evals play "human moves" rather than "computer moves", the result being the Maia-bots. You can try a similar approach to what they write in the paper, but instead of learning on random games learn on games of specific players (e.g. attacking players). This is easier said than done, however, as your training set will probably be extremely small compared to what Maia had to train. Here are some ideas on how you might make it work:

  • learn on self-play or human games, but weigh the games of the players you want to mimic much more heavily
  • try transfer learning
  • do some original research

Opening book

In order to help the bot to behave the way you intend, it is very advisable to give it an opening repertoire that suits its intended play-style.

This is done on chess.com to create bots of famous players.

If you prescribe your bot to play the sharpest variations of the Sicilian, it will be forced to play aggressively.

This will be a head start for your bot and I expect the opening book to make your task much easier.

Hauptideal
  • 6.3k
  • 16
  • 36