]> git.sesse.net Git - stockfish/commitdiff
Correctly handle castle in see()
authorMarco Costalba <mcostalba@gmail.com>
Fri, 20 May 2011 05:57:20 +0000 (06:57 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 20 May 2011 05:58:53 +0000 (06:58 +0100)
Suggested by Onno.

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

index 59c3a8c39f882f1bcb347f6dfeda5a78acfc7c10..b254d60b2020bc9632d2f20e002699d8bb4b8e98 100644 (file)
@@ -1513,6 +1513,12 @@ int Position::see(Move m) const {
 
   assert(move_is_ok(m));
 
+  // As castle moves are implemented as capturing the rook, they have
+  // SEE == RookValueMidgame most of the times (unless the rook is under
+  // attack).
+  if (move_is_castle(m))
+      return 0;
+
   from = move_from(m);
   to = move_to(m);
   capturedType = type_of_piece_on(to);