need to fix my infinite while so i make a checkpoint if i need to restore it

This commit is contained in:
Maoake Teriierooiterai
2026-03-24 09:34:53 +01:00
parent f8f0e31598
commit 030c6142ba
3 changed files with 42 additions and 25 deletions
+8 -6
View File
@@ -1,5 +1,6 @@
from amaz_lib.MazeGenerator import DepthFirstSearch
from amaz_lib.Cell import Cell
import numpy as np
class TestDepth:
@@ -12,7 +13,7 @@ class TestDepth:
def test_rand_cells(self) -> None:
w_h = (10, 10)
lst = DepthFirstSearch.add_cell_visited((0, 0))
lst = DepthFirstSearch.add_cell_visited((0, 0), set())
rand_cells = DepthFirstSearch.random_cells(lst, (0, 1), w_h)
assert len(rand_cells) == 2
@@ -24,10 +25,11 @@ class TestDepth:
def test_reverse_path(self) -> None:
assert DepthFirstSearch.reverse_path("N") == "S"
def test_last(self) -> None:
lst = [(0, 0), (1, 1)]
assert DepthFirstSearch.last(lst) == (1, 1)
def test_BOS(self) -> None:
path = [(0, 0), (0, 2), (1, 1)]
path = {(0, 0), (0, 2), (1, 1)}
assert len(DepthFirstSearch.random_cells(path, (0, 1), (10, 10))) == 0
def test_generator(self):
maze = np.array([])
maze = DepthFirstSearch.generator(10, 10)
assert maze.shape == (10, 10)