Skip to content

Commit

Permalink
[players] Init function accepts key set
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheus3375 committed Jul 18, 2024
1 parent 02c86c5 commit 0309a7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions solve/players.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from collections.abc import Mapping, Sequence
from dataclasses import dataclass

from solve.shapes import Shape2D
from solve.states import LEFT, MIDDLE, PositionsType, RIGHT, StateOfAllRooms, init_rooms
from .key_sets import KeySetType
from .shapes import Shape2D
from .states import LEFT, MIDDLE, PositionsType, RIGHT, StateOfAllRooms, init_rooms


@dataclass(frozen=True, kw_only=True, slots=True)
Expand All @@ -18,10 +19,13 @@ class Player:
def init_rooms_from_players(
players: Sequence[Player],
inner_shapes: Sequence[Shape2D],
key_set: KeySetType,
/,
) -> tuple[StateOfAllRooms, AliasMappingType]:
"""
Takes three players in solo rooms and 2D shapes of statues there in order from left to right.
Takes three players in solo rooms,
2D shapes of statues there in order from left to right,
and the current key set.
Returns initial state of solo rooms a mapping of positions to player aliases.
"""
assert len(players) == len(inner_shapes) == 3, f'number of players and shapes must be 3'
Expand All @@ -40,6 +44,7 @@ def init_rooms_from_players(
middle_other_shape=other[1],
right_inner_shape=inner_shapes[2],
right_other_shape=other[2],
key_set=key_set,
)

return state, aliases
Expand Down

0 comments on commit 0309a7e

Please sign in to comment.