created the move class
This commit is contained in:
parent
eca7a6ae0c
commit
324484aa31
@ -10,8 +10,6 @@ from logic.position import Position
|
||||
from typing import Type
|
||||
|
||||
class Board:
|
||||
KING_SIDE_CASTLE = "king side castle"
|
||||
QUEEN_SIDE_CASTLE = "queen side castle"
|
||||
def __init__(self) -> None:
|
||||
self._white: dict[Position, Piece] = {}
|
||||
self._black: dict[Position, Piece] = {}
|
||||
|
23
src/logic/move.py
Normal file
23
src/logic/move.py
Normal file
@ -0,0 +1,23 @@
|
||||
from logic.pieces.piece import Piece
|
||||
from logic.position import Position
|
||||
from enum import Enum
|
||||
|
||||
class Move:
|
||||
def to_algebraic(self) -> str:
|
||||
raise NotImplementedError("The move can't be translated to algbraic notation, as it was not implemented")
|
||||
|
||||
@staticmethod
|
||||
def from_algebraic(move: str) -> "Move":
|
||||
raise NotImplementedError("The move can't be translated from algbraic notation, as it was not implemented")
|
||||
|
||||
|
||||
class PieceMove(Move):
|
||||
def __init__(self, piece: Piece, pos: Position, is_capturing: bool) -> None:
|
||||
super().__init__()
|
||||
self.piece = piece
|
||||
self.pos = pos
|
||||
self.is_capturing = is_capturing
|
||||
|
||||
class Castle(Move, Enum):
|
||||
KING_SIDE_CASTLE = "O-O"
|
||||
QUEEN_SIDE_CASTLE = "O-O-O"
|
Loading…
x
Reference in New Issue
Block a user