本文整理汇总了Python中GoalieTransitions.dangerousBall方法的典型用法代码示例。如果您正苦于以下问题:Python GoalieTransitions.dangerousBall方法的具体用法?Python GoalieTransitions.dangerousBall怎么用?Python GoalieTransitions.dangerousBall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoalieTransitions
的用法示例。
在下文中一共展示了GoalieTransitions.dangerousBall方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: approachBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachBall(player):
"""
Once we are aligned with the ball, approach it
"""
# Switch to other states if we should
if player.penaltyKicking and \
player.brain.ball.inOppGoalBox():
return player.goNow('penaltyBallInOppGoalbox')
elif player.brain.tracker.activeLocOn:
if transitions.shouldScanFindBallActiveLoc(player):
return player.goLater('scanFindBall')
elif transitions.shouldScanFindBall(player):
return player.goLater('scanFindBall')
elif player.brain.play.isRole(GOALIE) and goalTran.dangerousBall(player):
return player.goNow('approachDangerousBall')
elif transitions.shouldDribble(player):
return player.goNow('dribble')
elif transitions.shouldSpinToBallClose(player):
return player.goNow('spinToBallClose')
elif transitions.shouldStopBeforeKick(player):
return player.goNow('stopBeforeKick')
elif transitions.shouldPositionForKick(player):
return player.goNow('decideKick')
if player.firstFrame():
player.brain.nav.chaseBall()
player.hasAlignedOnce = False
player.brain.tracker.trackBall()
return player.stay()
示例2: testDangerousBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def testDangerousBall(player):
if player.counter % 100 == 0:
if goalTran.dangerousBall(player):
print "dangerous"
else:
print "not dangerous"
return player.stay()
示例3: chase
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def chase(player):
"""
Super State to determine what to do from various situations
"""
if transitions.shouldFindBall(player):
return player.goNow('findBall')
if player.brain.play.isRole(GOALIE) and goalTran.dangerousBall(player):
return player.goNow('approachDangerousBall')
else:
return player.goNow('positionForKick')
示例4: approachBallWalk
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachBallWalk(player):
"""
Method that is used by both approach ball and dribble
We use things as to when we should leave and how we should walk
"""
if player.brain.playbook.role != pbc.GOALIE:
if transitions.shouldNotGoInBox(player):
return player.goLater('ballInMyBox')
elif transitions.shouldChaseAroundBox(player):
return player.goLater('chaseAroundBox')
elif transitions.shouldApproachBallWithLoc(player):
return player.goNow('approachBallWithLoc')
elif transitions.shouldTurnToBall_ApproachBall(player):
return player.goLater('turnToBall')
elif not player.brain.tracker.activeLocOn and \
transitions.shouldScanFindBall(player):
return player.goLater('scanFindBall')
elif player.brain.tracker.activeLocOn and \
transitions.shouldScanFindBallActiveLoc(player):
return player.goLater('scanFindBall')
elif transitions.shouldAvoidObstacleDuringApproachBall(player):
return player.goLater('avoidObstacle')
# Determine our speed for approaching the ball
ball = player.brain.ball
if player.brain.playbook.role == pbc.GOALIE and goalTran.dangerousBall(player):
return player.goNow('approachDangerousBall')
if ball.dist < constants.APPROACH_WITH_GAIN_DIST:
sX = MyMath.clip(ball.dist*constants.APPROACH_X_GAIN,
constants.MIN_APPROACH_X_SPEED,
constants.MAX_APPROACH_X_SPEED)
else :
sX = constants.MAX_APPROACH_X_SPEED
# Determine the speed to turn to the ball
sTheta = MyMath.clip(ball.bearing*constants.APPROACH_SPIN_GAIN,
-constants.APPROACH_SPIN_SPEED,
constants.APPROACH_SPIN_SPEED)
# Avoid spinning so slowly that we step in place
if fabs(sTheta) < constants.MIN_APPROACH_SPIN_MAGNITUDE:
sTheta = 0.0
# Set our walk towards the ball
if ball.on:
player.setSpeed(sX,0,sTheta)
return player.stay()
示例5: approachDangerousBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachDangerousBall(player):
if player.firstFrame():
player.stopWalking()
#print "approach dangerous ball"
#single steps towards ball and goal with spin
player.setSteps(0, 0, 0, 0)
if not goalTran.dangerousBall(player):
return player.goLater('approachBall')
if transitions.shouldScanFindBall(player):
return player.goLater('scanFindBall')
elif transitions.shouldTurnToBall_ApproachBall(player):
return player.goLater('turnToBall')
elif transitions.shouldSpinFindBall(player):
return player.goLater('spinFindBall')
return player.stay()
示例6: approachDangerousBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachDangerousBall(player):
"""adjusts position to be farther away from the ball
if the goalie is too close to the ball while in
the goal box"""
if player.firstFrame():
player.stopWalking()
#move away from the ball so it is no longer dangerous
if player.brain.nav.isStopped():
if player.brain.ball.loc.relY > 0:
player.brain.nav.walk(0, -15, 0)
else:
player.brain.nav.walk(0, 15, 0)
if not goalTran.dangerousBall(player) or transitions.shouldFindBall(player):
return player.goLater('chase')
return player.stay()
示例7: approachDangerousBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachDangerousBall(player):
ball = player.brain.ball
my = player.brain.my
if player.firstFrame():
player.stopWalking()
#move away from the ball so it is no longer dangerous
if player.brain.nav.isStopped():
if ball.relY > 0:
player.brain.nav.walk(0, -15, 0)
else:
player.brain.nav.walk(0, 15, 0)
if not goalTran.dangerousBall(player):
return player.goLater('chase')
if transitions.shouldScanFindBall(player):
return player.goLater('scanFindBall')
return player.stay()
示例8: approachDangerousBall
# 需要导入模块: import GoalieTransitions [as 别名]
# 或者: from GoalieTransitions import dangerousBall [as 别名]
def approachDangerousBall(player):
if player.firstFrame():
player.stopWalking()
#print "approach dangerous ball"
#single steps towards ball and goal with spin
#player.setSteps(0, 0, 0, 0)
ball = player.brain.ball
my = player.brain.my
if player.brain.nav.isStopped():
if ball.dist >= 10:
if ball.y > my.y + 7:
player.brain.nav.walk(0, 10, 0)
elif ball.y < my.y - 7:
player.brain.nav.walk(0, -10, 0)
if not goalTran.dangerousBall(player):
return player.goLater('chase')
if transitions.shouldScanFindBall(player):
return player.goLater('scanFindBall')
return player.stay()