-
-
Save NicolaM94/75826a753105c3a3aecae4f6890b631a to your computer and use it in GitHub Desktop.
Solution to the algorithm
This file contains 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
from pieces import * | |
blackKing = (5,8) | |
pawn = Pawn(7,2) | |
print("Pawn moves: ",pawn.possibleMoves()) | |
for pos in pawn.possibleMoves(): | |
if king == pos: | |
print("Check by the pawn!") | |
tower = Tower(5,3) | |
print("Tower moves: ",tower.possibleMoves()) | |
for pos in tower.possibleMoves(): | |
if king == pos: | |
print("Check by the tower!") | |
bishop = Bishop(2,7) | |
print("Bishop moves: ",bishop.possibleMoves()) | |
for pos in bishop.possibleMoves(): | |
if king == pos: | |
print("Check by the bishop!") | |
queen = Queen(3,2) | |
print("Queen moves: ",queen.possibleMoves()) | |
for pos in queen.possibleMoves(): | |
if king == pos: | |
print("Check by the queen!") | |
knight = Knight(6,6) | |
print("Knight moves: ",knight.possibleMoves()) | |
for pos in knight.possibleMoves(): | |
if king == pos: | |
print("Check by the knight!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment