50 lines
937 B
Python
50 lines
937 B
Python
import pandas as pd
|
|
import matplotlib.pyplot as plt
|
|
|
|
df = pd.read_csv("maze_results.csv")
|
|
|
|
mazes = df["maze"].unique()
|
|
|
|
for maze in mazes:
|
|
maze_df = df[df["maze"] == maze]
|
|
|
|
plt.figure(figsize=(8, 5))
|
|
|
|
plt.bar(
|
|
maze_df["strategy"],
|
|
maze_df["time_ms"]
|
|
)
|
|
|
|
plt.title(f"Time for {maze}")
|
|
plt.ylabel("Time ms")
|
|
plt.xlabel("Strategy")
|
|
|
|
plt.tight_layout()
|
|
|
|
filename = maze.split("/")[-1].replace(".txt", "_time.png")
|
|
plt.savefig(filename)
|
|
|
|
plt.close()
|
|
|
|
for maze in mazes:
|
|
maze_df = df[df["maze"] == maze]
|
|
|
|
plt.figure(figsize=(8, 5))
|
|
|
|
plt.bar(
|
|
maze_df["strategy"],
|
|
maze_df["visited_cells"]
|
|
)
|
|
|
|
plt.title(f"Visited cells for {maze}")
|
|
plt.ylabel("Visited cells")
|
|
plt.xlabel("Strategy")
|
|
|
|
plt.tight_layout()
|
|
|
|
filename = maze.split("/")[-1].replace(".txt", "_visited.png")
|
|
plt.savefig(filename)
|
|
|
|
plt.close()
|
|
|
|
print("Graphs created") |