120120castlingKingPiece = k
121121extinctionValue = loss
122122extinctionPieceTypes = k
123+
124+ [coregaldrop:coregal]
125+ pieceDrops = true
126+ startFen = rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[Qq] w KQkq - 0 1
127+
128+ [cannonatomic:atomic]
129+ cannon = c
123130"""
124131
125132sf .load_variant_config (ini_text )
@@ -346,6 +353,11 @@ def test_legal_moves(self):
346353 result = sf .legal_moves ("seirawan" , fen , [])
347354 self .assertIn ("c8g4h" , result )
348355
356+ # Drop pseudo-royals into check
357+ result = sf .legal_moves ("coregaldrop" , sf .start_fen ("coregaldrop" ), [])
358+ self .assertIn ("Q@a3" , result )
359+ self .assertNotIn ("Q@a6" , result )
360+
349361 # In Cannon Shogi the FGC and FSC can also move one square diagonally and, besides,
350362 # move or capture two squares diagonally, by leaping an adjacent piece.
351363 fen = "lnsg1gsnl/1rc1kuab1/p1+A1p1p1p/3P5/6i2/6P2/P1P1P3P/1B1U1ICR1/LNSGKGSNL[] w - - 1 3"
@@ -397,7 +409,7 @@ def test_legal_moves(self):
397409 self .assertEqual (['d4c2' , 'd4f3' , 'd4b5' , 'd4e6' ], result )
398410
399411
400- def test_short_castling (self ):
412+ def test_castling (self ):
401413 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' ]
402414 moves = ['b2b4' , 'f7f5' , 'c2c3' , 'g8d5' , 'a2a4' , 'h8g6' , 'f2f3' , 'i8h6' , 'h2h3' ]
403415 result = sf .legal_moves ("capablanca" , CAPA , moves )
@@ -417,6 +429,20 @@ def test_short_castling(self):
417429 result = sf .legal_moves ("diana" , "rbnk1r/pppbpp/3p2/5P/PPPPPB/RBNK1R w KQkq - 2 3" , [])
418430 self .assertIn ("d1f1" , result )
419431
432+ # Atomic960 castling
433+ fen = "7k/8/8/8/8/8/2PP4/1RK4q w Q - 0 1"
434+ moves = sf .legal_moves ("atomic" , fen , [], True )
435+ # 'c1b1' is the castling move (king to rook square in 960 encoding) and must be illegal
436+ self .assertNotIn ("c1b1" , moves )
437+ # A normal king/commoner move like c1b2 should remain legal
438+ self .assertIn ("c1b2" , moves )
439+
440+ # Atomic960 anti-discovered check with cannon
441+ fen = "8/8/8/8/8/6k1/8/c5KR w K - 0 1"
442+ moves = sf .legal_moves ("cannonatomic" , fen , [], True )
443+ self .assertNotIn ("g1h1" , moves )
444+ self .assertIn ("g1f1" , moves )
445+
420446 # Check that in variants where castling rooks are not in the corner
421447 # the castling rook is nevertheless assigned correctly
422448 result = sf .legal_moves ("shako" , "c8c/ernbqkbnre/pppppppppp/10/10/10/10/PPPPPPPPPP/5K2RR/10 w Kkq - 0 1" , [])
0 commit comments