Skip to content

Commit

Permalink
[states] Add max_cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheus3375 committed Jul 17, 2024
1 parent 1b08b31 commit 1a2b860
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions solve/states/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class StateWithAllPositions[S: State, M: PMove]:
"""
__slots__ = 'left', 'middle', 'right', 'moves_made'

max_cycles: int
"""
The maximum number of cycles to solve states of this type.
"""

def __init__(self, /, left: S, middle: S, right: S, moves_made: tuple[M, ...] = ()) -> None:
self.left = left
self.middle = middle
Expand Down
2 changes: 2 additions & 0 deletions solve/states/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def pass_shape(self, shape: Shape2D, other: Self, /) -> [Self, Self]:
class StateOfAllRooms(StateWithAllPositions[RoomState, PassMove]):
__slots__ = ()

max_cycles = 6

def next_states(self, /, is_doing_triumph: bool) -> Iterator[Self]:
"""
Yields all possible next states.
Expand Down
2 changes: 2 additions & 0 deletions solve/states/statues.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def dissect(self, shape1: Shape2D, other: Self, shape2: Shape2D, /) -> [Self, Se
class StateOfAllStatues(StateWithAllPositions[StatueState, DissectMove]):
__slots__ = ()

max_cycles = 3

def next_states(self, /, is_doing_triumph: bool) -> Iterator[Self]:
"""
Yields all possible next states.
Expand Down

0 comments on commit 1a2b860

Please sign in to comment.