Skip to main content

Posts

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
Recent posts

Making engine fast

18 Dec 2022 2:40 am planning to make a major change in the codebase: using  enum  instead of  char  for pieces. This is to elude branching in code? added best move tester solved a small bug in move generation 5 am completed the change to  enum  for pieces maybe the engine is now faster? (because we can now access piece-square tables directly using index without branching)

Engine understands clock and avoids draws

  28 Oct 2022 3 am bugfixes: fixed hard to find enpassant bug! AI part: code refactorings engine understands clock!! BIGGEST UPDATES: iterative deepening mate distance pruning null move pruning late move reduction others: simplified position hash engine now avoids draws! TODO: verify all of them, i guess i'm rushing into adding more and more features. i've spent around one week on this commit, now it's time for me to focus on my academics :|

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!

Making moves with the Negamax algorithm

  10 Sept 2022 after a loooonngg time!!! 4:50 am there's a lot to tell you, but firstly, i'm very happy now because i just teached my ai to capture pieces and guess what, it doesn't just look one move into the future. yes guys, i wrote the negamax algorithm!! it's much more fun to play with it now. but still it has to prioritize other things besides captures, like promotions, checks, pins etc. and obviously, mates! now i'm going to sleep as i got many works to do :(

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

Perft to find bugs in move generation

22 Jun 2022 after 2 am almost completed legal move generation function issue : sometimes switches black and white during random play issue : handling castling rights and enpassant squares while undoing a move 23 Jun 2022 after 12 am bugfix :  san  notation doesn't show promotion added  perft  and  divide  function now we can find corner cases easily! 2 am wasted 1 hour on why I'm getting 1 move less than expected reason: code generates kingside  else  queenside castling moves 🥲 3 am bugfix : now engine checks threatened squares during castling improved  perft  function still a lot of things to do (getting wrong  perft  results)