X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=maze.py;h=f6715f022b4e7776c4f19ab17d1a55d3f78285e6;hb=363ce48d64d1a036b86d29564bf6ad367126c2b1;hp=f6a852e37241f176a65a7cd69c6c8cb934a3a1fc;hpb=f23843d33a4fa5a38f5034deab8f473793732ee3;p=picoclvr.git diff --git a/maze.py b/maze.py index f6a852e..f6715f0 100755 --- a/maze.py +++ b/maze.py @@ -13,6 +13,8 @@ v_empty, v_wall, v_start, v_goal, v_path = 0, 1, 2, 3, 4 def create_maze(h=11, w=17, nb_walls=8): + assert h % 2 == 1 and w % 2 == 1 + a, k = 0, 0 while k < nb_walls: @@ -322,9 +324,9 @@ def save_image( if __name__ == "__main__": device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - mazes, paths = create_maze_data(8) + mazes, paths, policies = create_maze_data(8) mazes, paths = mazes.to(device), paths.to(device) - save_image("test.png", mazes, paths, paths) + save_image("test.png", mazes=mazes, target_paths=paths, predicted_paths=paths) print(path_correctness(mazes, paths)) ######################################################################