def is_finished(self, current_node: Node): """ Finish if the current node is the destination node. :param current_node: The current node. :return: If the path has been found or not, if so, return the cheapest path. """ if current_node == self.dest_node: # Destroying the vinculum costs 5 minutes, with a tritanium-blaster 1 minute if current_node.tritanium_blaster >= 1: current_node.g = current_node.g + 1 current_node.f = current_node.g + current_node.h current_node.tritanium_blaster = current_node.tritanium_blaster - 1 current_node.regeneration_time = current_node.regeneration_time - 1 else: current_node.g = current_node.g + 5 current_node.f = current_node.g + current_node.h current_node.regeneration_time = current_node.regeneration_time - 5 # Reconstruct the path path = self.reconstruct_path(current_node) for node in path: logging.debug(node) logging.info('Destination reached, final cost: %f' % current_node.g) return path return False