parse_attribute("castlingKingPiece", v->castlingKingPiece[BLACK], v->pieceToChar);
parse_attribute("castlingKingPieceWhite", v->castlingKingPiece[WHITE], v->pieceToChar);
parse_attribute("castlingKingPieceBlack", v->castlingKingPiece[BLACK], v->pieceToChar);
+ parse_attribute("castlingRookKingsideFile", v->castlingRookKingsideFile);
+ parse_attribute("castlingRookQueensideFile", v->castlingRookQueensideFile);
parse_attribute("castlingRookPieces", v->castlingRookPieces[WHITE], v->pieceToChar);
parse_attribute("castlingRookPieces", v->castlingRookPieces[BLACK], v->pieceToChar);
parse_attribute("castlingRookPiecesWhite", v->castlingRookPieces[WHITE], v->pieceToChar);
self.assertIn("d6d7m", result)
self.assertNotIn("d6d7", result)
+ # Test configurable piece perft
+ legals = ['a3a4', 'b3b4', 'c3c4', 'd3d4', 'e3e4', 'f3f4', 'g3g4', 'e1e2', 'f1f2', 'b1a2', 'b1b2', 'b1c2', 'c1b2', 'c1c2', 'c1d2', 'a1a2', 'g1g2', 'd1c2', 'd1d2', 'd1e2']
+ result = sf.legal_moves("yarishogi", sf.start_fen("yarishogi"), [])
+ self.assertCountEqual(legals, result)
+
def test_short_castling(self):
legals = ['f5f4', 'a7a6', 'b7b6', 'c7c6', 'd7d6', 'e7e6', 'i7i6', 'j7j6', 'a7a5', 'b7b5', 'c7c5', 'e7e5', 'i7i5', 'j7j5', 'b8a6', 'b8c6', 'h6g4', 'h6i4', 'h6j5', 'h6f7', 'h6g8', 'h6i8', 'd5a2', 'd5b3', 'd5f3', 'd5c4', 'd5e4', 'd5c6', 'd5e6', 'd5f7', 'd5g8', 'j8g8', 'j8h8', 'j8i8', 'e8f7', 'c8b6', 'c8d6', 'g6g2', 'g6g3', 'g6f4', 'g6g4', 'g6h4', 'g6e5', 'g6g5', 'g6i5', 'g6a6', 'g6b6', 'g6c6', 'g6d6', 'g6e6', 'g6f6', 'g6h8', 'f8f7', 'f8g8', 'f8i8']
moves = ['b2b4', 'f7f5', 'c2c3', 'g8d5', 'a2a4', 'h8g6', 'f2f3', 'i8h6', 'h2h3']
result = sf.legal_moves("diana", "rbnk1r/pppbpp/3p2/5P/PPPPPB/RBNK1R w KQkq - 2 3", [])
self.assertIn("d1f1", result)
- # Test configurable piece perft
- legals = ['a3a4', 'b3b4', 'c3c4', 'd3d4', 'e3e4', 'f3f4', 'g3g4', 'e1e2', 'f1f2', 'b1a2', 'b1b2', 'b1c2', 'c1b2', 'c1c2', 'c1d2', 'a1a2', 'g1g2', 'd1c2', 'd1d2', 'd1e2']
- result = sf.legal_moves("yarishogi", sf.start_fen("yarishogi"), [])
- self.assertCountEqual(legals, result)
+ # Check that in variants where castling rooks are not in the corner
+ # the castling rook is nevertheless assigned correctly
+ result = sf.legal_moves("shako", "c8c/ernbqkbnre/pppppppppp/10/10/10/10/PPPPPPPPPP/5K2RR/10 w Kkq - 0 1", [])
+ self.assertIn("f2h2", result)
+ result = sf.legal_moves("shako", "c8c/ernbqkbnre/pppppppppp/10/10/10/10/PPPPPPPPPP/RR3K4/10 w Qkq - 0 1", [])
+ self.assertIn("f2d2", result)
def test_get_fen(self):
result = sf.get_fen("chess", CHESS, [])