Mauritz8 / Vividmind

A UCI-compatible chess engine written from scratch in C++
1 stars 0 forks source link

faster check detection #104

Closed Mauritz8 closed 1 year ago

Mauritz8 commented 1 year ago

Currently it generates all the threatened moves of the opponent and look if any of them end on the kings square. It would be a lot more efficient to only look at moves starting from the king square. So generate all rook moves starting at the kings position, all bishop moves, and all knight moves. This should speed up move generation a lot, since like 80% of the time is spent seeing if the king is left in check.

Mauritz8 commented 1 year ago

This improved performance significantly! These old tests used to take 6-7 seconds to finish, so this is a wild improvement. image

The new tests are almost twice as fast! It now takes 10 sec instead of 17. image