about summary refs log tree commit diff stats
path: root/apworld/locations.py
diff options
context:
space:
mode:
Diffstat (limited to 'apworld/locations.py')
-rw-r--r--apworld/locations.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/apworld/locations.py b/apworld/locations.py index 3d619dc..174a0dd 100644 --- a/apworld/locations.py +++ b/apworld/locations.py
@@ -1,4 +1,13 @@
1from BaseClasses import Location 1from enum import Enum
2
3from BaseClasses import Location, Item
4from .items import Lingo2Item
5
6
7class LetterPlacementType(Enum):
8 ANY = 0
9 DISALLOW = 1
10 FORCE = 2
2 11
3 12
4class Lingo2Location(Location): 13class Lingo2Location(Location):
@@ -6,3 +15,19 @@ class Lingo2Location(Location):
6 15
7 port_id: int 16 port_id: int
8 goal: bool 17 goal: bool
18 letter_placement_type: LetterPlacementType
19
20 def set_up_letter_rule(self, lpt: LetterPlacementType):
21 self.letter_placement_type = lpt
22 self.item_rule = self._l2_item_rule
23
24 def _l2_item_rule(self, item: Item) -> bool:
25 if not isinstance(item, Lingo2Item):
26 return True
27
28 if self.letter_placement_type == LetterPlacementType.FORCE:
29 return item.is_letter
30 elif self.letter_placement_type == LetterPlacementType.DISALLOW:
31 return not item.is_letter
32
33 return True