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 for pellets/food.
Marker for power capsules.
A special marker for scared ghosts.
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.
Inherited Members
- pacai.core.board.Board
- source
- height
- width
- search_target
- copy
- size
- get_corners
- agent_count
- agent_indexes
- get
- get_marker_positions
- get_marker_count
- get_walls
- remove_agent
- remove_marker
- place_marker
- get_neighbors
- get_adjacency
- get_adjacent_walls
- is_empty
- is_marker
- is_wall
- get_agent_position
- get_agent_initial_position
- get_nonwall_string
- to_grid
- to_dict
- from_dict