without class piece_moves
This commit is contained in:
parent
1a4c25911d
commit
9b1699d65b
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,11 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class Bishop(Piece):
|
class Bishop(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("bishop", color)
|
|
||||||
|
|
||||||
def straightline_moves(self, piece, row, column, isvertical):
|
def straightline_moves(self, piece, row, column, isvertical):
|
||||||
if isvertical is True:
|
if isvertical is True:
|
||||||
self.direction = [
|
self.direction = [
|
||||||
|
5
king.py
5
king.py
@ -1,10 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class King(Piece):
|
class King(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("king", color)
|
|
||||||
|
|
||||||
def king_moves(self, piece, row, column):
|
def king_moves(self, piece, row, column):
|
||||||
self.direction = [
|
self.direction = [
|
||||||
(0, 1),
|
(0, 1),
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class Knight(Piece):
|
class Knight(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("knight", color)
|
|
||||||
|
|
||||||
def knight_moves(self, piece, row, column):
|
def knight_moves(self, piece, row, column):
|
||||||
self.possible_moves = [
|
self.possible_moves = [
|
||||||
(row + 2, column - 1),
|
(row + 2, column - 1),
|
||||||
|
6
move.py
6
move.py
@ -88,9 +88,9 @@ class Move:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def pawn_promotion(self, x, final_row, final_column):
|
def pawn_promotion(self, x, final_row, final_column):
|
||||||
if isinstance(x, Pawn):
|
if x.name == "pawn":
|
||||||
if (final_row==0) or (final_row==7):
|
if (final_row==0) or (final_row==7):
|
||||||
self.board.boardlist[final_row][final_column].piece = Queen(x.color)
|
x.name == "queen"
|
||||||
def mat(self, x, final_row, final_column):
|
def mat(self, x, final_row, final_column):
|
||||||
if self.board.boardlist[final_row][final_column].has_piece():
|
if self.board.boardlist[final_row][final_column].has_piece():
|
||||||
if self.board.boardlist[final_row][final_column].piece.name == 'king':
|
if self.board.boardlist[final_row][final_column].piece.name == 'king':
|
||||||
@ -98,7 +98,7 @@ class Move:
|
|||||||
#print(x)
|
#print(x)
|
||||||
#print(x.color)
|
#print(x.color)
|
||||||
#print(self.board.boardlist[final_row][final_column].piece.color)
|
#print(self.board.boardlist[final_row][final_column].piece.color)
|
||||||
self.board.boardlist[final_row][final_column].piece = x
|
#self.board.boardlist[final_row][final_column].piece = x
|
||||||
exit(0)
|
exit(0)
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def numbers_to_letters(number):
|
def numbers_to_letters(number):
|
||||||
|
4
pawn.py
4
pawn.py
@ -1,9 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class Pawn(Piece):
|
class Pawn(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("pawn", color)
|
|
||||||
def pawn_moves(self, piece, row, column):
|
def pawn_moves(self, piece, row, column):
|
||||||
if piece.moved == True:
|
if piece.moved == True:
|
||||||
self.steps = 1
|
self.steps = 1
|
||||||
|
5
queen.py
5
queen.py
@ -1,10 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class Queen(Piece):
|
class Queen(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("queen", color)
|
|
||||||
|
|
||||||
def straightline_moves(self, piece, row, column, isvertical):
|
def straightline_moves(self, piece, row, column, isvertical):
|
||||||
if isvertical is True:
|
if isvertical is True:
|
||||||
self.direction = [
|
self.direction = [
|
||||||
|
5
rook.py
5
rook.py
@ -1,10 +1,9 @@
|
|||||||
from piece import Piece
|
from piece import Piece
|
||||||
from board import Board
|
from board import Board
|
||||||
from square import Square
|
from square import Square
|
||||||
|
from abc import abstractmethod
|
||||||
class Rook(Piece):
|
class Rook(Piece):
|
||||||
def __init__(self, color):
|
@abstractmethod
|
||||||
super().__init__("rook", color)
|
|
||||||
|
|
||||||
def straightline_moves(self, piece, row, column, isvertical):
|
def straightline_moves(self, piece, row, column, isvertical):
|
||||||
if isvertical is True:
|
if isvertical is True:
|
||||||
self.direction = [
|
self.direction = [
|
||||||
|
@ -20,11 +20,6 @@ class Square:
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
def empty_or_rival_knight(self, color):
|
|
||||||
if self.has_piece() is False or self.is_rival(color):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def on_board(*args):
|
def on_board(*args):
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
Loading…
Reference in New Issue
Block a user