+ sys.stdout.write(" Valid! (Path: \""+agentExecutable+"\")\n")
+
+ #Convert array of valid names into array of dictionaries containing information about each agent
+ #I'm starting to like python...
+ agents.append({"name":name, "path":agentExecutable,"score":[0], "totalScore":0, "VICTORY":[], "DEFEAT":[], "DRAW":[], "ILLEGAL":[], "INTERNAL_ERROR":[], "ALL":[]})
+
+if len(agents) == 0:
+ print "Couldn't find any agents! Check paths (Edit this script) or generate \"info\" files for agents."
+ sys.exit(0)
+if verbose:
+ print "Total: " + str(len(agents)) + " valid agents found (From "+str(len(agentNames))+" possibilities)"
+ print ""
+
+#Prepare the pretty .html files if they don't exist
+htmlDir = resultsDirectory + "pretty/"
+if os.path.exists(htmlDir) == False:
+ os.mkdir(htmlDir)
+if os.path.exists(htmlDir) == False:
+ print "Couldn't create directory \""+htmlDir+"\"."
+ sys.exit(1)
+
+for agent in agents:
+ if os.path.exists(htmlDir+agent["name"] + ".html") == False:
+ agentFile = open(htmlDir+agent["name"] + ".html", "w")
+ agentFile.write("<html>\n<head>\n <title> " + agent["name"] + " results</title>\n</head>\n<body>\n<h1> Results for " + agent["name"]+" </h1>\n</body>\n</html>\n")
+ agentFile.close()
+
+ os.rename(htmlDir+agent["name"] + ".html", "tmpfile")
+
+ oldFile = open("tmpfile")
+ agentFile = open(htmlDir+agent["name"] + ".html", "w")
+ for line in oldFile:
+ if line.strip() == "</body>":
+ break
+ agentFile.write(line + "\n")
+ oldFile.close()
+ agentFile.close()
+ os.remove("tmpfile")
+
+#Do each round...
+totalGames = nGames/2 * len(agents) * (len(agents)-1)
+for roundNumber in range(totalRounds, totalRounds + nRounds):
+
+ if os.path.exists(logDirectory + "round"+str(roundNumber)) == False:
+ os.mkdir(logDirectory + "round"+str(roundNumber)) #Check there is a directory for this round's logs
+
+
+ print "Commencing ROUND " + str(roundNumber) + " combat!"
+ print "Total: " + str(totalGames) + " games to be played. This could take a while... (Estimate 60s/game)"
+