本文整理汇总了Python中Board.adjacent_cells方法的典型用法代码示例。如果您正苦于以下问题:Python Board.adjacent_cells方法的具体用法?Python Board.adjacent_cells怎么用?Python Board.adjacent_cells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.adjacent_cells方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _approach
# 需要导入模块: import Board [as 别名]
# 或者: from Board import adjacent_cells [as 别名]
def _approach (self, enemy, faceTorsoEnemy):
i = 0
x = 0
while True:
x = Board.adjacent_cells(enemy, (faceTorsoEnemy+i)%6, self.board)
i += 1
if (not x in self.mechs.enemys_cell()) and x != 0: break
pf = pathfinder.PathFinder(self.board.successors, self.board.move_cost, self.board.heuristic_to_goal)
A = Pos(self.playerCell, self.playerFace)
B = Pos(x, Board.facing_side(x, enemy))
if A == B: return ([], 3)
path, can, cost = pf.compute_path_until_PM (A, B, 0, self.player.walk)
if can == False and self.player.run != 0:
path2, can2, cost2 = pf.compute_path_until_PM(A, B, 1, self.player.run)
if can2 == True:
return (path2, 1)
if can == False and self.player.jump != 0:
print "ESTO K ES!: walk then jump"
print self.player.walk
print self.player.jump
path3, can3, cost3 = pf.compute_path_until_PM(A, B, 2, self.player.jump)
if (can3 == True) or (self.player.jump >= self.player.walk):
return (path3,2)
return (path, 0)
示例2: posible_positions
# 需要导入模块: import Board [as 别名]
# 或者: from Board import adjacent_cells [as 别名]
def posible_positions (self,enemyCell, distance2enemy):
positions = []
faceEnemy = relative_position (self.playerCell, enemyCell)
face = faceEnemy
#if distance2enemy <3:
# face = (face+3)%6
cell = self.playerCell
newCell = cell
for i in range(2):
cell = newCell
for j in [0,1,-1]:
newCell = Board.adjacent_cells(cell, face+j, self.board)
if newCell == 0: continue
# Miramos si ai algun bosque denso o ligero
obj = self.board.map[newCell[0]][newCell[1]].objects
if obj == 1 or obj == 2:
positions.append(newCell)
return positions, faceEnemy