File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3654,7 +3654,8 @@ def status(self) -> Status:
36543654 if self .was_into_check ():
36553655 errors |= STATUS_OPPOSITE_CHECK
36563656
3657- # More than the maximum number of possible checkers in the variant.
3657+ # More than the maximum number of possible checkers in the variant,
3658+ # or impossibly aligned checkers.
36583659 checkers = self .checkers_mask ()
36593660 our_kings = self .kings & self .occupied_co [self .turn ] & ~ self ._effective_promoted ()
36603661 if checkers :
@@ -3673,6 +3674,11 @@ def status(self) -> Status:
36733674 if popcount (checkers ) > 2 or (popcount (checkers ) == 2 and ray (lsb (checkers ), msb (checkers )) & our_kings ):
36743675 errors |= STATUS_IMPOSSIBLE_CHECK
36753676
3677+ # Multiple steppers.
3678+ steppers = self .pawns | self .knights | self .kings
3679+ if popcount (checkers & steppers ) > 1 :
3680+ errors |= STATUS_IMPOSSIBLE_CHECK
3681+
36763682 return errors
36773683
36783684 def _valid_ep_square (self ) -> Optional [Square ]:
Original file line number Diff line number Diff line change @@ -1042,6 +1042,10 @@ def test_status(self):
10421042 board = chess .Board ("8/8/5k2/p1q5/PP1rp1P1/3P1N2/2RK1r2/5nN1 w - - 0 3" )
10431043 self .assertEqual (board .status (), chess .STATUS_VALID )
10441044
1045+ # Multiple stepping checkers.
1046+ board = chess .Board ("8/8/N7/2k5/N7/8/8/3K4 b - - 0 1" )
1047+ self .assertEqual (board .status (), chess .STATUS_IMPOSSIBLE_CHECK )
1048+
10451049 def test_one_king_movegen (self ):
10461050 board = chess .Board .empty ()
10471051 board .set_piece_at (chess .A1 , chess .Piece (chess .KING , chess .WHITE ))
@@ -4566,6 +4570,11 @@ def test_atomic_validity(self):
45664570 board = chess .variant .AtomicBoard ("3N1NB1/2N1Q1N1/3RkR2/2NP1PN1/3NKN2/8/8/n7 w - - 0 1" )
45674571 self .assertEqual (board .status (), chess .STATUS_VALID )
45684572
4573+ # Multiple stepping checkers possible, because opponent king may have
4574+ # moved away.
4575+ board = chess .variant .AtomicBoard ("8/8/N7/2k1K3/N7/8/8/8 b - - 0 1" )
4576+ self .assertEqual (board .status (), chess .STATUS_VALID )
4577+
45694578 def test_atomic960 (self ):
45704579 pgn = io .StringIO (textwrap .dedent ("""\
45714580 [Variant "Atomic"]
You can’t perform that action at this time.
0 commit comments