I am now working on generating moves in chess. I am writing move generation function for every piece (pawn,knight,bishop...)and i currently generation all possible moves without any kind of filtering.
I wonder what is the preffered way to assert that the king is not in check after the move is played (e.g if the move is valid). The way i see it, I have to actually play the move on the board and only than can I know that the king is not exposed or attacked. But should I make this valiadation in the alpha-beta function (in the actual evaluation stage) ? or maybe "artificialy" make the move inside the moves generation function and decide if i should add it to the list in the first place.
Also, can you give me some tips on how to improve the move generation ? maybe not generate all possible moves?
Thx.