@@ -65,11 +65,8 @@ def has_all_of(self, items: Iterable[int]) -> bool:
6565 return False
6666 return True
6767
68- def count_of (self , items : Iterable [int ]) -> int :
69- s = 0
70- for i in items :
71- s += self .solv_items [i ]
72- return s
68+ def count_distinct (self , items : Iterable [int ]) -> int :
69+ return sum (1 for i in items if self .solv_items [i ] > 0 )
7370
7471 def item_count (self , item : int ) -> int :
7572 return self .solv_items [item ]
@@ -93,17 +90,17 @@ def heart_count(self) -> int:
9390 )
9491
9592 def has_medallions (self , count : int ) -> bool :
96- return self .count_of (ItemInfo .medallion_ids ) >= count
93+ return self .count_distinct (ItemInfo .medallion_ids ) >= count
9794
9895 def has_stones (self , count : int ) -> bool :
99- return self .count_of (ItemInfo .stone_ids ) >= count
96+ return self .count_distinct (ItemInfo .stone_ids ) >= count
10097
10198
10299 def has_dungeon_rewards (self , count : int ) -> bool :
103- return ( self .count_of (ItemInfo .medallion_ids ) + self .count_of (ItemInfo .stone_ids ) ) >= count
100+ return self .count_distinct (ItemInfo .medallion_ids ) + self .count_distinct (ItemInfo .stone_ids ) >= count
104101
105102 def has_ocarina_buttons (self , count : int ) -> bool :
106- return ( self .count_of (ItemInfo .ocarina_buttons_ids ) ) >= count
103+ return self .count_distinct (ItemInfo .ocarina_buttons_ids ) >= count
107104
108105 # TODO: Store the item's solver id in the goal
109106 def has_item_goal (self , item_goal : dict [str , Any ]) -> bool :
0 commit comments