diff --git a/catanatron_core/catanatron/models/board.py b/catanatron_core/catanatron/models/board.py index 327e3c2d..ff2d97d1 100644 --- a/catanatron_core/catanatron/models/board.py +++ b/catanatron_core/catanatron/models/board.py @@ -274,9 +274,8 @@ def get_player_port_resources(self, color): resources = set() for resource, node_ids in self.map.port_nodes.items(): - for node_id in node_ids: - if self.get_node_color(node_id) == color: - resources.add(resource) + if any(self.is_friendly_node(node_id, color) for node_id in node_ids): + resources.add(resource) self.player_port_resources_cache[color] = resources return resources @@ -341,6 +340,9 @@ def is_enemy_road(self, edge, color): edge_color = self.get_edge_color(edge) return edge_color is not None and self.get_edge_color(edge) != color + def is_friendly_node(self, node_id, color): + return self.get_node_color(node_id) == color + def is_friendly_road(self, edge, color): return self.get_edge_color(edge) == color