Legality Test
Posted: 31 Mar 2010, 15:41
I'm writing a chess engine,I'm working on move generation and I have the following dillema:
when generating moves how do I make sure that the move I make won't let my king in check.Of course I could check this for every move I make but that would be very inefficient.
I read about precomputing some bitboards so I could do a simple look-up and applying bitwise operations to tell if my move is valid:
"The common approach is to apply a pre-calculated 64 times 64 array for every from- or to-square. Containing bitboards with in-between or obstructed sets for distant squares sharing the same line. If the intersection with occupied squares is empty, the move is considered valid. This is implicitly true for squares in king- and knight distance as well since they already contain zero."
My question is what should the bitboards contain,can you explain me what this line is about "Containing bitboards with in-between or obstructed sets for distant squares sharing the same line".
Thanks you.
when generating moves how do I make sure that the move I make won't let my king in check.Of course I could check this for every move I make but that would be very inefficient.
I read about precomputing some bitboards so I could do a simple look-up and applying bitwise operations to tell if my move is valid:
"The common approach is to apply a pre-calculated 64 times 64 array for every from- or to-square. Containing bitboards with in-between or obstructed sets for distant squares sharing the same line. If the intersection with occupied squares is empty, the move is considered valid. This is implicitly true for squares in king- and knight distance as well since they already contain zero."
My question is what should the bitboards contain,can you explain me what this line is about "Containing bitboards with in-between or obstructed sets for distant squares sharing the same line".
Thanks you.