Simplify the only-beatable mode.

This also makes it faster.
This commit is contained in:
Kevin Cathcart
2017-11-05 22:08:36 -05:00
parent 5336e6c693
commit 17cd963665
3 changed files with 17 additions and 14 deletions

View File

@@ -183,6 +183,13 @@ class World(object):
return True
return False
def has_beaten_game(self, state):
if state.has('Triforce'): return True
if self.goal in ['triforcehunt']:
if state.item_count('Triforce Piece')+state.item_count('Power Star')> self.treasure_hunt_count:
return True
return False
def can_beat_game(self, starting_state=None):
prog_locations = [location for location in self.get_locations() if location.item is not None and (location.item.advancement or location.event)]
@@ -317,7 +324,10 @@ class CollectionState(object):
if count == 1:
return item in self.prog_items
else:
return len([pritem for pritem in self.prog_items if pritem == item]) >= count
return self.item_count(item) >= count
def item_count(self, item):
return len([pritem for pritem in self.prog_items if pritem == item])
def can_lift_rocks(self):
return self.has('Power Glove') or self.has('Titans Mitts')