def test_to_string(): wall = Cell('X') ground = Cell('_') cell_array = np.array([[wall, wall, wall], [ground, ground, ground], [wall, wall, wall]]) maze = Maze(cell_array=cell_array) maze_string = maze.to_string() assert maze_string == "X-X-X\n_-_-_\nX-X-X"
def test_constructing_with_cellarray(): wall = Cell('X') ground = Cell('_') cell_array = np.array([[wall, wall, wall], [ground, ground, ground], [wall, wall, wall]]) maze = Maze(cell_array=cell_array) assert maze.grid.all() == cell_array.all()
def test_to_string2(): maze = Maze() maze_string = maze.to_string() assert maze_string == (("X-" * 9 + "X\n") * 10)[:-1]
def test_constructing_with_wrong_gridshape3(): with pytest.raises(AssertionError): Maze(grid_shape=(5, ))
def test_constructing_with_wrong_gridshape2(): with pytest.raises(TypeError): Maze(grid_shape=5)
def test_empty_constructor(): maze = Maze() assert np.shape(maze.grid) == ( 10, 10) # decided on (10, 10) to be standard maze size
from src.view.tui import Tui from src.view.tui import Gui from src.model.maze.Maze import Maze from src.model.agent.Agent import Agent from src.controller.environment import Environment import logging from threading import Thread logging.basicConfig(level=logging.DEBUG, format='%(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(str(__name__).split(".")[-1].upper().strip("_")) if __name__ == '__main__': # tui_thread = Thread(target=Tui, args=(logging.INFO,)) # tui_thread.start() tui = Tui() gui = Gui() agent = Agent() maze = Maze() controller = Environment() tui.add_controller(controller) gui.add_controller(controller) agent.add_view(tui, gui) controller.add_model(agent, maze) controller.add_view(tui, gui) while 1: pass