def labyrinthe(carte, case_init, case_fin): lab = Maze() lab.start = case_init lab.end = case_fin lab.generator = Prims(6, 6) lab.generate() n = random.randint(0, 1) for i in range(11): for j in range(11): if lab.grid[i + 1][j + 1] == 1: if n == 0: carte[i][j] = "eau" else: carte[i][j] = "lave" else: carte[i][j] = "herbe"
0, 1 ], [ 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ], [ 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]] m.grid = np.array(miz) m.start = (0, 13) m.end = (24, 19) m.solve() sol = m.solutions[0] for i in range(len(sol) - 1): x = sol[i][0] y = sol[i][1] xn = sol[i + 1][0] yn = sol[i + 1][1] #print(f"x -> {x} y- >{y} xn -> {xn} yn -> {yn}") if (x - xn) > 0: print("j", end="") elif (y - yn) > 0: print("h", end="") elif (yn - y) > 0: