now the legal moves function actually returns a
list of moves
This commit is contained in:
parent
324484aa31
commit
c3e46017eb
@ -1,4 +1,6 @@
|
|||||||
|
from logic.move import Move
|
||||||
from .piece import Piece
|
from .piece import Piece
|
||||||
|
|
||||||
class Bishop(Piece):
|
class Bishop(Piece):
|
||||||
pass
|
def legal_moves(self, board) -> list[Move]:
|
||||||
|
return super().legal_moves(board)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from logic.position import Position
|
from logic.move import Move
|
||||||
from logic.pieces.piece import Piece
|
from logic.pieces.piece import Piece
|
||||||
|
|
||||||
class Pawn(Piece):
|
class Pawn(Piece):
|
||||||
def legal_moves(self, board) -> list[Position]:
|
def legal_moves(self, board) -> list[Move]:
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
# can we capture to the left?
|
# can we capture to the left?
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from logic.position import Position
|
from logic.position import Position
|
||||||
|
from logic.move import Move
|
||||||
|
|
||||||
|
|
||||||
class Piece:
|
class Piece:
|
||||||
@ -13,5 +14,5 @@ class Piece:
|
|||||||
def position(self) -> Position:
|
def position(self) -> Position:
|
||||||
return self.pos
|
return self.pos
|
||||||
|
|
||||||
def legal_moves(self, board) -> list[Position]:
|
def legal_moves(self, board) -> list[Move]:
|
||||||
raise NotImplementedError(f"Can't say what the legal moves are for {type(self).__name__}, the method hasn't been implemented yet")
|
raise NotImplementedError(f"Can't say what the legal moves are for {type(self).__name__}, the method hasn't been implemented yet")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user