File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,18 +92,14 @@ impl super::Board {
9292
9393 fn collect_castling ( & self , list : & mut MoveList ) {
9494 let stm = self . side_to_move ( ) ;
95- self . collect_castling_kind ( list, CastlingKind :: KINDS [ stm] [ 0 ] ) ; //queenside
96- self . collect_castling_kind ( list, CastlingKind :: KINDS [ stm] [ 1 ] ) ; //kingside
97- }
98-
99- fn collect_castling_kind ( & self , list : & mut MoveList , kind : CastlingKind ) {
100- let stm = self . side_to_move ( ) ;
101- if self . castling ( ) . is_allowed ( kind)
102- && ( self . castling_path [ kind] & self . occupancies ( ) ) . is_empty ( )
103- && ( self . castling_threat [ kind] & self . all_threats ( ) ) . is_empty ( )
104- && !self . pinned ( stm) . contains ( self . castling_rooks [ kind] )
105- {
106- list. push ( self . king_square ( stm) , kind. landing_square ( ) , MoveKind :: Castling ) ;
95+ for kind in [ CastlingKind :: KINDS [ stm] [ 0 ] , CastlingKind :: KINDS [ stm] [ 1 ] ] {
96+ if self . castling ( ) . is_allowed ( kind)
97+ && ( self . castling_path [ kind] & self . occupancies ( ) ) . is_empty ( )
98+ && ( self . castling_threat [ kind] & self . all_threats ( ) ) . is_empty ( )
99+ && !self . pinned ( stm) . contains ( self . castling_rooks [ kind] )
100+ {
101+ list. push ( self . king_square ( stm) , kind. landing_square ( ) , MoveKind :: Castling ) ;
102+ }
107103 }
108104 }
109105
You can’t perform that action at this time.
0 commit comments