def defaultView(self): self.view = View(self.recorder, self.viewCallback) self.view.startNewThread()
# Start knights tour try: path = [] # If closed loop solution create list for final check if closed_loop: end_positions = gen_possible_moves(initial_pos) tour(1, path, initial_pos) except PathFound: if closed_loop: printl("Readjust starting point back to original position") start = path.index(start_pos) path_from_start = path[start:] for x in path[0:start]: path_from_start.append(x) path = path_from_start return path size = 10 tour = KnightsTour(size, (2, 0), True) print(tour) speed = 0.05 square_size = 50 if GUI_ON: pygame.init() dimensions = (square_size * size, square_size * size) model = Model(size, size, tour, square_size) view = View(model, dimensions, speed) view.animate_path()