当前位置: 首页>>代码示例>>Python>>正文


Python GoalieTransitions.dangerousBall方法代码示例

本文整理汇总了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()
开发者ID:bbellon,项目名称:nbites,代码行数:33,代码来源:ChaseBallStates.py

示例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()
开发者ID:hoangtuananh,项目名称:nbites,代码行数:10,代码来源:GoalieTestStates.py

示例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')
开发者ID:Lrosias,项目名称:nbites,代码行数:14,代码来源:ChaseBallStates.py

示例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()
开发者ID:iris-xx,项目名称:nao-man,代码行数:51,代码来源:ChaseBallStates.py

示例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()
开发者ID:Zakat,项目名称:nao-man,代码行数:19,代码来源:ChaseBallStates.py

示例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()
开发者ID:Lrosias,项目名称:nbites,代码行数:20,代码来源:ChaseBallStates.py

示例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()
开发者ID:bbellon,项目名称:nbites,代码行数:21,代码来源:ChaseBallStates.py

示例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()
开发者ID:alawrenc,项目名称:nbites,代码行数:23,代码来源:ChaseBallStates.py


注:本文中的GoalieTransitions.dangerousBall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。