lib/just_chess/pieces/king.rb in just_chess-1.0.7 vs lib/just_chess/pieces/king.rb in just_chess-1.0.8
- old
+ new
@@ -70,10 +70,11 @@
# the current game state.
#
# @return [SquareSet]
def checked_squares(square, game_state)
dup = game_state.clone
+ # set piece to nil to handle case where a piece threatens squares behind the king
dup.squares.find_king_for_player(player_number).piece = nil
dup.squares.threatened_by(opponent, dup)
end
# All the squares that the king could not move to because another king is nearby.
@@ -92,6 +93,7 @@
set
end
end
end
end
-end
\ No newline at end of file
+end
+