Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions chess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,17 @@ def gives_check(self, move: Move) -> bool:
finally:
self.pop()

def gives_checkmate(self, move: Move) -> bool:
"""
Probes if the given move would put the opponent in checkmate. The move
must be at least pseudo-legal.
"""
self.push(move)
try:
return self.is_checkmate()
finally:
self.pop()

def is_into_check(self, move: Move) -> bool:
king = self.king(self.turn)
if king is None:
Expand Down