Skip to content

Commit

Permalink
[states.rooms] Add RoomState.current_key
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheus3375 committed Jul 19, 2024
1 parent 8a5041c commit a00414d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion solve/states/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .base import *
from ..key_sets import KSMixed, KeySetType
from ..multiset import Multiset
from ..shapes import Shape2D
from ..shapes import Shape2D, Shape3D


@dataclass(frozen=True, kw_only=True, slots=True)
Expand Down Expand Up @@ -63,6 +63,17 @@ def is_done(self, /) -> bool:
def shapes_available(self, /) -> Multiset[Shape2D]:
return self.dropping_shapes

@property
def current_key(self, /) -> Shape3D:
"""
The 3D shape a player can get after collecting dropping shapes.
"""
if self.dropping_shapes.total == 2:
s1, s2 = self.dropping_shapes.elements()
return s1 + s2

raise ValueError('3D shape is not available')

def pass_shape(self, shape: Shape2D, other: Self, /) -> [Self, Self]:
"""
Transfers a shape from this room to the other.
Expand Down

0 comments on commit a00414d

Please sign in to comment.