コード例 #1
0
ファイル: fdCenterdClient.py プロジェクト: dosydon/multiban
 def map_to_action(self, map, current_player):
     if (FDCenterdClient.turn) <= 1:
         self.generagePlan(map)
     lines = [line.strip("\n") for line in open("fast-res.txt").readlines()]
     move = fast2move.fast2move(lines, FDCenterdClient.turn)
     FDCenterdClient.turn += 1
     return move.encode("utf-8")
コード例 #2
0
ファイル: fdIndClient.py プロジェクト: dosydon/multiban
 def map_to_action(self,map,current_player):
     FASTDOWNWARD = '~/downward/src/'
     self.write_map(map)
     subprocess.call('python map2domain.py < map.txt > domain.pddl',shell=True)
     subprocess.call('python map2instance.py %d < map.txt > instance.pddl'%(1),shell=True)
     self.log(message="Calling FastDownward")
     subprocess.call(FASTDOWNWARD+'fast-downward.py domain.pddl instance.pddl --search "astar(lmcut())" > fast-res.txt',shell=True)
     lines = [line.strip('\n') for line in open('fast-res.txt').readlines()]
     move = fast2move.fast2move(lines,1)
     self.log(message="Done!")
     return (move.encode('utf-8'))