-
- '''
- Obselete, non prettified results
- if verbose:
- sys.stdout.write("Creating raw results files for ROUND " + str(roundNumber) + "... ")
-
- agents.sort(key = lambda e : e["score"], reverse=True) #Sort the agents based on score
-
- resultsFile = open(resultsDirectory+"round"+str(roundNumber)+".results", "w") #Create a file to store all the scores for this round
- for agent in agents:
- resultsFile.write(agent["name"] + " " + str(agent["score"]) +"\n") #Write the agent names and scores into the file, in descending order
-
- if verbose:
- sys.stdout.write(" Complete!\n")
- sys.stdout.write("Updating total scores... ");
-
- #Now update the total scores
- if os.path.exists(resultsDirectory+"total.scores"):
- if verbose:
- sys.stdout.write(" Reading from \""+resultsDirectory+"total.scores\" to update scores... ")
- totalFile = open(resultsDirectory+"total.scores", "r") #Try to open the total.scores file
- for line in totalFile: #For all entries,
- data = line.split(' ')
- for agent in agents:
- if agent["name"] == data[0]:
- agent["totalScore"] = int(data[1]) + agent["score"][0] #Simply increment the current score by the recorded total score of the matching file entry
- break
- totalFile.close() #Close the file, so we can delete it
- os.remove(resultsDirectory+"total.scores") #Delete the file
- #Sort the agents again
- agents.sort(key = lambda e : e["totalScore"], reverse=True)
-
- else:
- if verbose:
- sys.stdout.write(" First round - creating \""+resultsDirectory+"total.scores\"... ")
- if verbose:
- sys.stdout.write(" Complete!\n")
- print "Finished writing results for ROUND " + str(roundNumber)
- print ""
- '''