from MazeSolver.Solver import MazeSolver
import csv

def RunBenchmark(maze, strategies, repeats = 5):
    rows = []
    
    for name, strategy in strategies.items():

        solver = MazeSolver(maze, strategy)

        for _ in range(repeats):
            stats, _  = solver.solve()

            rows.append([name, stats.time_ms, stats.visited_cells, stats.path_length])

    with open("results.csv", "w", newline="") as f:
        writer = csv.writer(f)
        writer.writerow(["strategy", "time_ms", "visited", "path_length"])
        writer.writerows(rows)
    