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.
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.