Пример #1
0
    def generate_starting_points(self):
        start_points = []
        GraphicsPoint.setLastID(0)
        for i in range(self.NUM_POINTS):
            start_points.append(
                GraphicsPoint(random.randint(50, gc.WINDOW_WIDTH - 50),
                              random.randint(50, gc.WINDOW_HEIGHT - 50)))

        return start_points
Пример #2
0
    def set_initial_state(self, initial_points, initial_paths):
        self.base_region = Region(set(initial_points),
                                  self.border_points,
                                  edge_map={},
                                  exclusions=set(),
                                  surf=self.SCREEN)

        for start_path, end_path, mid_point in initial_paths:
            current_region = self.base_region.find_region(mid_point)
            # Add the paths to the region
            current_region.update_region_tree([start_path, end_path],
                                              mid_point)

            self.paths.append(start_path)
            self.paths.append(end_path)

        self.points = set(initial_points)
        GraphicsPoint.setLastID(len(self.points))