def resolve_get_maze(root, info, layerApprox=1, color=False, size=4, seed=""): if seed != "": maze = mz.Maze(0, 0, seed) else: maze = mz.Maze(layerApprox, size) maze_package = { "points": maze.points, "solution": maze.solution, "layers": maze.layers, "size": maze.size, "seed": maze.seed, "color": maze.color } return maze_package
def __init__(self, file_name="temp", show_solution=False, size=1, layers_approx=3, seed=""): self.maze = mz.Maze(layers_approx, size, seed) self.file_name = file_name self.show_solution = show_solution self.create_svg()
def main(): tt.reset() tt.pensize(3) tt.speed(0) new_maze = mz.Maze(20, 3) drawseg(new_maze.points) tt.pensize(1) tt.pencolor(0.7, 0, 0) time.sleep(1.5) tt.speed(2) drawseg(new_maze.solution) print("points: ", new_maze.points) print("solution: ", new_maze.solution) print("layer-app: ", new_maze.layer_approx) print("layers: ", new_maze.layers) print("size: ", new_maze.size) print("seed: ", new_maze.seed) tt.exitonclick()
def test_layer_break(): sample = mz.Maze(10, 10, "AAA") sample.generate() assert sample.seed == "AAA"
def test_draw_layer(): sample = mz.Maze() output = sample.draw_layer("A") layer = output[2] assert layer == "A"
def test_draw_random_check_maize_part(): sample = mz.Maze() output = sample.draw_random() assert isinstance(output[0], list)
def test_generate_maze_seed(): sample = mz.Maze(0, 0, "AAA") sample.generate() assert sample.seed == "AAA"
def test_generate_maze(): sample = mz.Maze(4, 4) sample.generate() assert sample.size > 0
def test_draw_random_solution_validity_check(): sample = mz.Maze() output = sample.draw_random() solution = output[4] assert len(solution) > 1
def test_draw_random_maze_validity_check(): sample = mz.Maze() output = sample.draw_random() points = output[0] assert len(points) > 1
def test_draw_random_check_maize_solution(): sample = mz.Maze() output = sample.draw_random() assert isinstance(output[4], list)