/checkmate.py Secret
Last active
February 7, 2023 00:40
Check mate or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
otherPiecesMoves = Pawn(7,2).possibleMoves() + Tower(5,3).possibleMoves() + Bishop(2,7).possibleMoves() + Queen(3,2).possibleMoves()+ Knight(6,6).possibleMoves() | |
king = King(5,8) | |
print("King's moves: ",king.possibleMoves()) | |
stillAliveMoves = [] | |
for m in king.possibleMoves(): | |
if m not in otherPiecesMoves: | |
stillAliveMoves.append(m) | |
if len(stillAliveMoves) == 0: | |
print("Check mate!") | |
else: | |
print("Possible moves: ",stillAliveMoves) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment