def init_nodes(self): nodes = [Node(i) for i in range(54)] for idx, node in enumerate(nodes): boardPositions = nodeToHex[idx] for boardIdx in boardPositions: self.board[boardIdx].add_node(node) for conn in connectionIdxToNodeIdx: nodes[conn[0]].add_connection(nodes[conn[1]]) nodes[conn[1]].add_connection(nodes[conn[0]]) Board.add_harbors_to_nodes(nodes) return nodes
def start_new_game(self) -> Game: nodes = {} for city in self.cities: node = Node(city, self.infections[city]) connection = self.connections[city] for link in connection: if link in nodes: target = nodes[link] node.add_connection(target) nodes[city] = node return Game(nodes, self.diseases, [*self.infection_rate], self.starting_city)