mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
Core: some typing and documentation in BaseClasses.py (#2589)
This commit is contained in:
@@ -491,7 +491,7 @@ class MultiWorld():
|
|||||||
else:
|
else:
|
||||||
return all((self.has_beaten_game(state, p) for p in range(1, self.players + 1)))
|
return all((self.has_beaten_game(state, p) for p in range(1, self.players + 1)))
|
||||||
|
|
||||||
def can_beat_game(self, starting_state: Optional[CollectionState] = None):
|
def can_beat_game(self, starting_state: Optional[CollectionState] = None) -> bool:
|
||||||
if starting_state:
|
if starting_state:
|
||||||
if self.has_beaten_game(starting_state):
|
if self.has_beaten_game(starting_state):
|
||||||
return True
|
return True
|
||||||
@@ -504,7 +504,7 @@ class MultiWorld():
|
|||||||
and location.item.advancement and location not in state.locations_checked}
|
and location.item.advancement and location not in state.locations_checked}
|
||||||
|
|
||||||
while prog_locations:
|
while prog_locations:
|
||||||
sphere = set()
|
sphere: Set[Location] = set()
|
||||||
# build up spheres of collection radius.
|
# build up spheres of collection radius.
|
||||||
# Everything in each sphere is independent from each other in dependencies and only depends on lower spheres
|
# Everything in each sphere is independent from each other in dependencies and only depends on lower spheres
|
||||||
for location in prog_locations:
|
for location in prog_locations:
|
||||||
@@ -524,12 +524,19 @@ class MultiWorld():
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_spheres(self):
|
def get_spheres(self) -> Iterator[Set[Location]]:
|
||||||
|
"""
|
||||||
|
yields a set of locations for each logical sphere
|
||||||
|
|
||||||
|
If there are unreachable locations, the last sphere of reachable
|
||||||
|
locations is followed by an empty set, and then a set of all of the
|
||||||
|
unreachable locations.
|
||||||
|
"""
|
||||||
state = CollectionState(self)
|
state = CollectionState(self)
|
||||||
locations = set(self.get_filled_locations())
|
locations = set(self.get_filled_locations())
|
||||||
|
|
||||||
while locations:
|
while locations:
|
||||||
sphere = set()
|
sphere: Set[Location] = set()
|
||||||
|
|
||||||
for location in locations:
|
for location in locations:
|
||||||
if location.can_reach(state):
|
if location.can_reach(state):
|
||||||
|
Reference in New Issue
Block a user