pacai.pacman.board

 1import typing
 2
 3import pacai.core.board
 4
 5MARKER_PELLET: pacai.core.board.Marker = pacai.core.board.Marker('.')
 6""" Marker for pellets/food. """
 7
 8MARKER_CAPSULE: pacai.core.board.Marker = pacai.core.board.Marker('o')
 9""" Marker for power capsules. """
10
11MARKER_SCARED_GHOST: pacai.core.board.Marker = pacai.core.board.Marker('!')
12""" A special marker for scared ghosts. """
13
14class Board(pacai.core.board.Board):
15    """
16    A board for Pacman.
17
18    In addition to walls, Pacman boards also have:
19    pellets ('.')
20    and capsules ('o').
21    """
22
23    def __init__(self, *args: typing.Any, additional_markers: list[str] | None = None, **kwargs: typing.Any) -> None:
24        if (additional_markers is None):
25            additional_markers = []
26
27        additional_markers += [
28            MARKER_PELLET,
29            MARKER_CAPSULE,
30        ]
31
32        super().__init__(*args, additional_markers = additional_markers, **kwargs)  # type: ignore
MARKER_PELLET: pacai.core.board.Marker = '.'

Marker for pellets/food.

MARKER_CAPSULE: pacai.core.board.Marker = 'o'

Marker for power capsules.

MARKER_SCARED_GHOST: pacai.core.board.Marker = '!'

A special marker for scared ghosts.

class Board(pacai.core.board.Board):
15class Board(pacai.core.board.Board):
16    """
17    A board for Pacman.
18
19    In addition to walls, Pacman boards also have:
20    pellets ('.')
21    and capsules ('o').
22    """
23
24    def __init__(self, *args: typing.Any, additional_markers: list[str] | None = None, **kwargs: typing.Any) -> None:
25        if (additional_markers is None):
26            additional_markers = []
27
28        additional_markers += [
29            MARKER_PELLET,
30            MARKER_CAPSULE,
31        ]
32
33        super().__init__(*args, additional_markers = additional_markers, **kwargs)  # type: ignore

A board for Pacman.

In addition to walls, Pacman boards also have: pellets ('.') and capsules ('o').

Board( *args: Any, additional_markers: list[str] | None = None, **kwargs: Any)
24    def __init__(self, *args: typing.Any, additional_markers: list[str] | None = None, **kwargs: typing.Any) -> None:
25        if (additional_markers is None):
26            additional_markers = []
27
28        additional_markers += [
29            MARKER_PELLET,
30            MARKER_CAPSULE,
31        ]
32
33        super().__init__(*args, additional_markers = additional_markers, **kwargs)  # type: ignore

Construct a board. The board details will either be parsed from board_text is provided, or taken directly from the given underscore arguments.