-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBothGraphsForEnvironmentAnalysisCreate.py
More file actions
66 lines (50 loc) · 2.56 KB
/
BothGraphsForEnvironmentAnalysisCreate.py
File metadata and controls
66 lines (50 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
#Define CSV File Name for plotting
hostile_csv_genetic_aLgorithm_file="Hostile_GeneticAlgorithmData/002_Hostile_GeneticAlgorithm.csv"
random_csv_genetic_aLgorithm_file="GeneticAlgorithmData/002_GeneticAlgorithm.csv"
hostile_raw_statistics = pd.read_csv(hostile_csv_genetic_aLgorithm_file)
random_raw_statistics = pd.read_csv(random_csv_genetic_aLgorithm_file)
#1 Ghosts Eaten
hostile_generation_groups_mean = hostile_raw_statistics.groupby("Gen").mean()
random_generation_groups_mean = random_raw_statistics.groupby("Gen").mean()
plt.figure(figsize=(10,2.5))
plt.xticks(range(0, int(hostile_generation_groups_mean.index.max()) + 1))
plt.title('Mean Ghosts Eaten by Generation')
plt.plot(hostile_generation_groups_mean.index, hostile_generation_groups_mean['Ghosts Eaten'], label='Hostile: Ghosts Eaten', color='red',marker='x',markeredgewidth=2)
plt.plot(random_generation_groups_mean.index, random_generation_groups_mean['Ghosts Eaten'], label='Random: Ghosts Eaten', color='black',marker='x',markeredgewidth=2)
plt.xlabel('Generation')
plt.ylabel('Ghosts Eaten')
plt.grid(True, linestyle='--', alpha=1)
plt.legend()
plt.yticks(np.arange(0, 11, 1))
plt.yticks(np.arange(0, 10))
plt.show()
#2 Turns Taken
plt.figure(figsize=(10,4))
plt.yticks(np.arange(350, 601, 25))
plt.ylim(350, 600)
plt.xticks(range(0, int(hostile_generation_groups_mean.index.max()) + 1))
plt.plot(hostile_generation_groups_mean.index, hostile_generation_groups_mean['Turns_Taken'], label='Hostile: Mean Turns', color='red',marker='x',markeredgewidth=2)
plt.plot(random_generation_groups_mean.index, random_generation_groups_mean['Turns_Taken'], label='Random: Mean Turns', color='black',marker='x',markeredgewidth=2)
plt.grid(True, linestyle='--', alpha=1)
plt.title('Mean Turns Taken by Generation')
plt.xlabel('Generation')
plt.ylabel('Mean Turns Taken')
plt.legend()
plt.show()
#3 Lives Remaining
plt.figure(figsize=(10,4))
plt.yticks(np.arange(0, 16, 1))
plt.ylim(0, 12)
plt.xticks(range(0, int(hostile_generation_groups_mean.index.max()) + 1))
plt.plot(hostile_generation_groups_mean.index, hostile_generation_groups_mean['Lives'], label='Hostile: Lives Remaining', color='red',marker='x',markeredgewidth=2)
plt.plot(random_generation_groups_mean.index, random_generation_groups_mean['Lives'], label='Random: Lives Remaining', color='black',marker='x',markeredgewidth=2)
plt.grid(True, linestyle='--', alpha=1)
plt.title('Mean Lives Remaining by Generation')
plt.xlabel('Generation')
plt.ylabel('Mean Lives Remaining')
plt.legend()
plt.show()