本文整理汇总了Python中GameState.GameState.reward方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.reward方法的具体用法?Python GameState.reward怎么用?Python GameState.reward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState.GameState
的用法示例。
在下文中一共展示了GameState.reward方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getNextStep
# 需要导入模块: from GameState import GameState [as 别名]
# 或者: from GameState.GameState import reward [as 别名]
def getNextStep(self,state):
listState=[]
st=time.time()
if state.player==SELF_PLAYER:
tmpPlayer=ENEMS_PLAYER
else:
tmpPlayer=SELF_PLAYER
loc,dirs=self.getMoveCombinationAll(tmpPlayer, state)
for i in range(len(loc)):
tempLoc=loc[i]
tempDirs=dirs[i]
colisionMove=False
for e in tempLoc:
if tempLoc.count(e)>1:
colisionMove=True
if colisionMove:
continue
cMap=self.getClearMap(state,tmpPlayer)
for (r,c) in tempLoc:
cMap[r][c]=tmpPlayer
s=GameState(cMap, tmpPlayer)
s.dirs=tempDirs
listKill=self.preKill(s)
for (r,c,p) in listKill:
s.map[r][c]=LAND
s.reward=(len(self.getAnts(s,SELF_PLAYER)),len(self.getAnts(s, ENEMS_PLAYER)))
listState.append(s)
return listState
示例2: result
# 需要导入模块: from GameState import GameState [as 别名]
# 或者: from GameState.GameState import reward [as 别名]
def result(self,state,a):
[loc,dir]=a
if state.player==SELF_PLAYER:
tmpPlayer=ENEMS_PLAYER
else:
tmpPlayer=SELF_PLAYER
cMap=self.getClearMap(state,tmpPlayer)
for (r,c) in loc:
cMap[r][c]=tmpPlayer
s=GameState(cMap, tmpPlayer)
s.dirs=dir
s.loc=loc
self.saveSumDistance(s)
listKill=self.preKill(s)
for (r,c,p) in listKill:
s.map[r][c]=LAND
s.reward=(len(self.getAnts(s,SELF_PLAYER)),len(self.getAnts(s, ENEMS_PLAYER)))
return s