from builders.text_file_maze_builder import TextFileMazeBuilder

from strategies.bfs_strategy import BFS
from strategies.dfs_strategy import DFSStrategy
from strategies.astar_strategy import AStarStrategy

from solver.maze_solver import MazeSolver

from observer.console_view import ConsoleView


mazes = {
    "1": "small.txt",
    "2": "medium.txt",
    "3": "large.txt",
    "4": "no_exit.txt"
}

strategies = {
    "1": BFS(),
    "2": DFSStrategy(),
    "3": AStarStrategy()
}


print("Choose maze:")
print("1 - small")
print("2 - medium")
print("3 - large")
print("4 - no_exit")

maze_choice = input("> ")

print()

print("Choose strategy:")
print("1 - BFS")
print("2 - DFS")
print("3 - A*")

strategy_choice = input("> ")


builder = TextFileMazeBuilder()

maze = builder.build_from_file(
    f"mazes/{mazes[maze_choice]}"
)

strategy = strategies[strategy_choice]


solver = MazeSolver(
    maze,
    strategy
)

stats = solver.solve()


print(stats)


view = ConsoleView(maze)

solver.attach(view)