示例#1
0
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"
示例#2
0
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()
示例#3
0
def test_to_string2():
    maze = Maze()
    maze_string = maze.to_string()
    assert maze_string == (("X-" * 9 + "X\n") * 10)[:-1]
示例#4
0
def test_constructing_with_wrong_gridshape3():
    with pytest.raises(AssertionError):
        Maze(grid_shape=(5, ))
示例#5
0
def test_constructing_with_wrong_gridshape2():
    with pytest.raises(TypeError):
        Maze(grid_shape=5)
示例#6
0
def test_empty_constructor():
    maze = Maze()
    assert np.shape(maze.grid) == (
        10, 10)  # decided on (10, 10) to be standard maze size
示例#7
0
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