Changed log paths

This commit is contained in:
Marcin Kostrzewski 2020-05-17 11:17:08 +02:00
parent aa3eea8b39
commit df16339eef

View File

@ -215,20 +215,20 @@ def pickEntity(player, map):
def writeResults(iter, bestFit, bestMember): def writeResults(iter, bestFit, bestMember):
if iter == 0: if iter == 0:
# Initialize human-readable log file # Initialize human-readable log file
with open("results.txt", "w+") as f: with open("src/AI/resultsExplorer/results.txt", "w+") as f:
f.write("GA Results from " + str(datetime.now())) f.write("GA Results from " + str(datetime.now()))
f.write("\n") f.write("\n")
with open("resultsRaw.txt", "w+") as f: with open("src/AI/resultsExplorer/resultsRaw.txt", "w+") as f:
f.write("=HEADER=GA=\n") f.write("=HEADER=GA=\n")
with open("results.txt", "a") as f: with open("src/AI/resultsExplorer/results.txt", "a") as f:
f.write("Population: {}\n".format(iter)) f.write("Population: {}\n".format(iter))
f.write("Best fitness: {}\n".format(bestFit)) f.write("Best fitness: {}\n".format(bestFit))
f.write("Best offspring: " + str(bestMember)) f.write("Best offspring: " + str(bestMember))
f.write("\n\n") f.write("\n\n")
# Write raw arrays # Write raw arrays
with open("resultsRaw.txt", "a") as f: with open("src/AI/resultsExplorer/resultsRaw.txt", "a") as f:
f.write(str(bestMember + [bestFit])) f.write(str(bestMember + [bestFit]))
f.write("\n") f.write("\n")