Karma Riuk 947114877b
Some checks failed
pre-release / Pre Release (push) Waiting to run
tagged-release / Tagged Release (push) Has been cancelled
moved everything related to python in the python
folder
2025-02-02 13:20:59 +01:00

36 lines
983 B
Python

from logic.move import Move
from .piece import Piece
class Queen(Piece):
def legal_moves(self, board: "Board", / , looking_for_check = False) -> list[Move]:
ret = []
# looking north east
ret.extend(self._look_direction(board, 1, 1))
# looking south east
ret.extend(self._look_direction(board, 1, -1))
# looking south west
ret.extend(self._look_direction(board, -1, -1))
# looking north west
ret.extend(self._look_direction(board, -1, 1))
# looking east
ret.extend(self._look_direction(board, 1, 0))
# looking south
ret.extend(self._look_direction(board, 0, -1))
# looking west
ret.extend(self._look_direction(board, -1, 0))
# looking north
ret.extend(self._look_direction(board, 0, 1))
if not looking_for_check:# and board.is_check_for(self.colour):
return self.keep_only_blocking(ret, board)
return ret