Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pickomino_env/modules/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"ACTION_TUPLE_LENGTH",
"ANTIALIAS",
"BACKGROUND_COLOR",
"BOT_NAMES",
"BUTTONS_START_X",
"BUTTONS_START_Y",
"BUTTON_BORDER_RADIUS",
Expand Down Expand Up @@ -85,6 +86,7 @@
MAX_BOTS: Final[int] = 6
WORM_INDEX: Final[int] = 5
WORM_VALUE: Final[int] = 5
BOT_NAMES: Final[tuple[str, ...]] = ("Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot")

# Action constants.
ACTION_INDEX_DICE: Final[int] = 0
Expand Down
8 changes: 5 additions & 3 deletions pickomino_env/pickomino.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ACTION_INDEX_ROLL,
ACTION_ROLL,
ACTION_STOP,
BOT_NAMES,
LARGEST_TILE,
MAX_BOTS,
NUM_DICE,
Expand Down Expand Up @@ -195,7 +196,9 @@ def __init__(self, number_of_bots: int = 1, render_mode: str | None = None) -> N
self.render_mode = render_mode
self._renderer = Renderer(self.render_mode)

def render(self) -> NDArray[np.uint8] | None: # type: ignore[override]
def render( # type: ignore[override]
self,
) -> NDArray[np.uint8] | None:
"""Render the current game state.

Renders the environment to screen or returns an RGB array depending on render_mode.
Expand Down Expand Up @@ -223,10 +226,9 @@ def renderer(self) -> Renderer:

def _create_players(self) -> None:
"""Create the human (agent) player (player 0) and bot opponents with assigned names."""
names = ["Alfa", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot"]
self._game.players.append(self._game.you)
for i in range(self._number_of_bots):
self._game.players.append(Player(bot=True, name=names[i]))
self._game.players.append(Player(bot=True, name=BOT_NAMES[i]))

def _tiles_vector(self) -> np.ndarray[Any, np.dtype[Any]]:
"""Return available tiles as a flat binary vector of length 16 for indexes 21..36."""
Expand Down
Loading