final corrections before submission
This commit is contained in:
+2
-3
@@ -56,6 +56,5 @@ with open('type_effectiveness.json', 'r') as file:
|
||||
type_effectiveness.append(json.loads(line))
|
||||
type_effectiveness_df = pd.DataFrame.from_dict(type_effectiveness)
|
||||
#NOTE: from a practical point of view, since type_effectiveness is accessed many times
|
||||
#in the main code, using pandas DataFrame is not efficient. I decided to keep using dictionaries
|
||||
#for the type effectiveness. The justification arises especially if we consider
|
||||
#how long data generation will take.
|
||||
#in the main code I decided to keep using dictionaries
|
||||
#for the type effectiveness
|
||||
+5
-4
@@ -7,7 +7,6 @@ import pickle
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import os
|
||||
np.seterr(divide='raise', invalid='raise')
|
||||
|
||||
#if the results folder does not exist, create it
|
||||
if not os.path.exists('results'):
|
||||
@@ -220,17 +219,19 @@ def make_plots(Ngames,Nbattles):
|
||||
plt.savefig('plots/pokemon_types_distribution.pdf')
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Ngames = 1000
|
||||
Nbattles = 150
|
||||
|
||||
print("Generating data")
|
||||
for i in range(Ngames):
|
||||
#automatic player creation (choose a random starter pokemon)
|
||||
starter_choice = random.choice(gd.available_starters)
|
||||
#print(f"Generating data for {starter_choice}, game {i}...")
|
||||
print(f"Generating data for {starter_choice}, game {i}...")
|
||||
results = Main(starter_choice = starter_choice, Nbattles=Nbattles)
|
||||
pickle_out = open(f"results/{starter_choice}_game_{i}_{Nbattles}_battles.pickle",'wb')
|
||||
pickle.dump(results,pickle_out)
|
||||
pickle_out.close()
|
||||
print("Generating plots")
|
||||
make_plots(Ngames, Nbattles)
|
||||
make_plots(Ngames, Nbattles)
|
||||
print("Finished!")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user