New answers tagged

-1

As of June 24, 2021 where I am drafting this answer, I can guarantee to anyone that the above accepted answer is no longer true. The above provided zip file no longer works. Hence, I seek and I found. The optimal way is here. It is fully programmable, even your grandma can do it.


3

It is probably most efficient if I paste my code from my chess move generator on GitHub. int ROOK_ATTACK_SHIFTS[64]; Bitboard ROOK_ATTACK_MASKS[64]; Bitboard ROOK_ATTACKS[64][4096]; void initialise_rook_attacks() { Bitboard edges, subset, index; for (Square sq = a1; sq <= h8; ++sq) { edges = ((MASK_RANK[AFILE] | MASK_RANK[HFILE]) & ~...


6

You generate all the legal king moves up front, regardless of whether there's a check. Then determine the number of checking pieces. There will be two scenarios relevant to the question. If it is a double check, the only legal moves are king moves out of check, so you simply return the existing list of moves Single check is trickier. There are multiple cases ...


5

After 2...f5 white can take en passant: 3.e5xf6.You have to take this into account.


1

If you want to analyze a single game, IMHO the cleanest and best solution is to do that, as if stockfish would play a game against some other opponent, apart from the time control. Since this resembles the way, stockfish is tested and will always work. Note that it is important to command position startpos moves .... and not position <fen> since ...


Top 50 recent answers are included