gnome-games r8784 - in trunk/glchess: src/lib/chess tests



Author: rancell
Date: Fri Feb 27 13:41:17 2009
New Revision: 8784
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8784&view=rev

Log:
Stop king castling when blocked by pawn (Bug #571089)

Added:
   trunk/glchess/tests/castleblock6.pgn
Modified:
   trunk/glchess/src/lib/chess/board.py

Modified: trunk/glchess/src/lib/chess/board.py
==============================================================================
--- trunk/glchess/src/lib/chess/board.py	(original)
+++ trunk/glchess/src/lib/chess/board.py	Fri Feb 27 13:41:17 2009
@@ -561,7 +561,7 @@
                     return None
                 
                 # The square the king moves over cannot be attackable
-                if self.squareUnderAttack(colour, rookEndLocation, requirePiece = False):
+                if self.movePiece(colour, start, rookEndLocation, applyMove = False) is None:
                     return None
 
                 # Rook moves with the king
@@ -572,7 +572,7 @@
             playerState.canLongCastle = False
             
             moves.append((piece, start, end, False))
-                
+
         # Rooks move orthogonal
         elif piece.getType() is ROOK:
             # Can no longer castle once have move the required rook

Added: trunk/glchess/tests/castleblock6.pgn
==============================================================================
--- (empty file)
+++ trunk/glchess/tests/castleblock6.pgn	Fri Feb 27 13:41:17 2009
@@ -0,0 +1,11 @@
+[Event "Human versus Human"]
+[Site "?"]
+[Date "2009.02.28"]
+[Round "?"]
+[White "White"]
+[Black "Black"]
+[Result "*"]
+
+1. Nc3 d5 2. d3 Nf6 3. e3 Bg4 4. f3 Bf5 5. e4 Bg6 6. f4 dxe4 7. f5 Bxf5 8. Qh5
+Nxh5 9. Be2 Nf6 10. Bg5 exd3 11. Nf3 dxe2 *
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]