Skip to main content

How to write chess engines?

30 May 2022

night

  • how to write chess engines?
  • read some code
  • which language to choose?
    • python: easy, ready-made libraries, slow
    • js: almost same, nice gui
    • c++: hard, have to learn
    • c: hard and complex, hard to maintain, boring?

Comments

Popular posts from this blog

Faster move generation, Mate in X tests

  24 Dec 2022 1:30 am better  uci  handling, using  istringstream  to parse commands better Mate Score output added Mate in 2, 3, and 4 tests (and they pass! but slow) inlined some functions (maybe faster now?) added Search Type:  Infinite ,  Fixed Depth ,  Time per Move ,  Time per Game ,  Ponder  and  Mate . Not all of them are working yet :') 3 am movelist.reserve(40) : doing this made move generation ~1.5x faster! Now reserving in all vectors. modularized move generation added  get_threats  function

Better algorithms and Evaluation function

  11 Oct 2022 long time no see 3 am well, there's a lot of small and big changes. i'll try to explain by checking the diff. AI part: replaced minimax with alpha-beta (similar to negamax version) TODO : implement quiescence search added piece-square table scoring in eval function reduced branching in code move generation part: bugfix : moves like  e1c1  were always interpreted as castling, fixed changed board representation from  string  to  char[64] now king positions are incrementally saved, so faster to find kings several optimizations in move generation general: now engine trys to avoid moves leading to repetitions (but it is not always optimal, so should do something better) fixed several gui bugs in promotion and flipping gui supports (some) premoves fixed some bugs in move hints, still some remaining ig faster makefile BIGGEST UPDATES: uci protocol working! made a  lichess bot  running this engine!

Bugfixes in move generation

  27 Jun 2022 3 pm found one corner case: castling is still allowed after rook capture! 9 Jul 2022 afternoon fixed a corner case with promotion (earlier it always promoted to white pieces) 10 Jul 2022 after 12 am fixed a few corner cases with castling (pawns don't threaten blank squares) move count fixed planning to automate perft graphics??? afternoon another castling bug (capturing rook with king cleared only king's castling rights) reason:  else