Skip to content

chessmaker.chess.base.board

[view_source]

AfterNewPieceEvent

@dataclass(frozen=True)
class AfterNewPieceEvent(Event)

[view_source]

piece: Piece

[view_source]

AfterRemoveSquareEvent

@dataclass(frozen=True)
class AfterRemoveSquareEvent(Event)

[view_source]

position: Position

[view_source]

square: Square

[view_source]

BeforeRemoveSquareEvent

@dataclass(frozen=True)
class BeforeRemoveSquareEvent(AfterRemoveSquareEvent)

[view_source]

AfterAddSquareEvent

@dataclass(frozen=True)
class AfterAddSquareEvent(Event)

[view_source]

position: Position

[view_source]

square: Square

[view_source]

BeforeAddSquareEvent

@dataclass(frozen=True)
class BeforeAddSquareEvent(AfterAddSquareEvent)

[view_source]

set_square

def set_square(square: Square)

[view_source]

BeforeTurnChangeEvent

@dataclass(frozen=True)
class BeforeTurnChangeEvent(CancellableEvent)

[view_source]

board: "Board"

[view_source]

next_player: Player

[view_source]

set_next_player

def set_next_player(next_player: Player)

[view_source]

AfterTurnChangeEvent

@dataclass(frozen=True)
class AfterTurnChangeEvent(Event)

[view_source]

board: "Board"

[view_source]

player: Player

[view_source]

Board

@event_publisher(*SQUARE_EVENT_TYPES, *PIECE_EVENT_TYPES, BeforeAddSquareEvent, AfterAddSquareEvent,
                 BeforeRemoveSquareEvent, AfterRemoveSquareEvent, BeforeTurnChangeEvent, AfterTurnChangeEvent,
                 AfterNewPieceEvent)
class Board(Cloneable,  EventPublisher)

[view_source]

__init__

def __init__(squares: list[list[Square | None]], players: list[Player], turn_iterator: Iterator[Player], rules: list[Rule] = None)

[view_source]

__getitem__

def __getitem__(position: Position) -> Square | None

[view_source]

__setitem__

def __setitem__(position: Position, square: Square | None)

[view_source]

__iter__

def __iter__() -> Iterable[Square]

[view_source]

get_pieces

def get_pieces() -> Iterable[Piece]

[view_source]

get_player_pieces

def get_player_pieces(player: Player) -> Iterable[Piece]

[view_source]

clone

def clone()

[view_source]