def __init__(self, args): if len(args) > 0: agentName = args else: print("ERROR: Missing argument") sys.exit() print("start python client") ccomm = ClientComm(agentName) ccomm.startComm()
def __init__(self): AbstractPlayer.__init__(self) self.lastSsoType = LEARNING_SSO_TYPE.JSON self.plan_file = "files/plan.pkl" #Add file to read plan from self.comm = ClientComm(None) self.count = 0 self.has_key = False self.sso_traces = [] self.plan = [] self.current_trace = [] self.step = 0 self.max_steps = 30 self.max_score = 0 self.trace_recorder_file = "files/test_trace" self.actionFile = "files/actionFile" #this is used to read the winner state after game terminates try: with open(self.trace_recorder_file, "rb") as f: self.old_traces = pickle.load(f) except IOError: self.old_traces = [] pass try: with open(self.plan_file, "rb") as f: self.plan = pickle.load(f) except IOError: pass
gamesDir = serverDir gameFile = args.gameFile levelFile = args.levelFile print("Run game " + str(gameId) + " with agent " + agentName) if args.serverJar == '': if CompetitionParameters.OS_WIN: scriptFile = shDir + "\\runServer_nocompile_python.bat " + str(gameId) + " " + str(serverDir) + " " + str(visuals) else: scriptFile = os.path.join(shDir, "runServer_nocompile_python.sh " + str(gameId) + " " + str(serverDir) + " " + str(visuals)) else: # scriptFile = os.path.join(shDir, "runServer_compile.sh " + str(args.serverJar) + " " + str(gameId) + " " + str(serverDir)) scriptFile = os.path.join(shDir, "runServer_compile.sh " + str(args.serverJar) + " " + str(gameId) + " " + str(serverDir) + " " + gameFile + " " + levelFile) try: print("scriptFile to run is: "+scriptFile) p = subprocess.Popen(scriptFile, shell=True) print("Run server process [OK]") # print(str(os.getcwd())) # stdout, stderr = p.communicate() print("Run server communicate [OK]") ccomm = ClientComm(agentName) print("Start comm with agent " + agentName) ccomm.startComm() print("Server process finished [OK]") except Exception as e: logging.exception(e) print("Server process started [FAILED]") traceback.print_exc() sys.exit()
gameFile = args.gameFile levelFile = args.levelFile print("Run game " + str(gameId) + " with agent " + agentName) if args.serverJar == '': if CompetitionParameters.OS_WIN: scriptFile = shDir + "\\runServer_nocompile_python.bat " + str(gameId) + " " + str(serverDir) + " " + str(visuals) else: scriptFile = os.path.join(shDir, "runServer_nocompile_python.sh " + str(gameId) + " " + str(serverDir) + " " + str(visuals)) else: # scriptFile = os.path.join(shDir, "runServer_compile.sh " + str(args.serverJar) + " " + str(gameId) + " " + str(serverDir)) scriptFile = os.path.join(shDir, "runServer_compile.sh " + str(args.serverJar) + " " + str(gameId) + " " + str(serverDir) + " " + gameFile + " " + levelFile) try: print("scriptFile to run is: "+scriptFile) p = subprocess.Popen(scriptFile, shell=True) print("Run server process [OK]") # print(str(os.getcwd())) # stdout, stderr = p.communicate() print("Run server communicate [OK]") ccomm = ClientComm(agentName) print("Start comm with agent " + agentName) ccomm.startComm() print("Server process finished [OK]") except Exception as e: logging.exception(e) print("Server process started [FAILED]") traceback.print_exc() sys.exit()