Fix small bug in move_attacks_square()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 30 Oct 2011 17:59:12 +0000 (18:59 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 30 Oct 2011 18:31:50 +0000 (19:31 +0100)
commitc6f497f09de59ce4889c2045e0e4b6efb3082899
treef3c8c59b5fbb96373497fcbf930f0b7194e1442b
parent29be28e1a24898cec64470332740eaa54893b7a4
Fix small bug in move_attacks_square()

We test if the piece moved in 'to' attacks the square 's' with:

bit_is_set(attacks_from(piece, to), s))

But we should instead consider the new occupancy, changed after
the piece is moved, and so test with:

bit_is_set(attacks_from(piece, to, occ), s))

Otherwise we can miss some cases, for instance a queen in b1 that
moves in c1 is not detected to attack a1 while instead she does.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp