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


Python Location.headingTo方法代码示例

本文整理汇总了Python中objects.Location.headingTo方法的典型用法代码示例。如果您正苦于以下问题:Python Location.headingTo方法的具体用法?Python Location.headingTo怎么用?Python Location.headingTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在objects.Location的用法示例。


在下文中一共展示了Location.headingTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: determineChaseTime

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
    def determineChaseTime(self):
        """
        Attempt to define a time in seconds to get to the ball.
        Can give penalties in certain situations.
        @ return: returns a time in seconds with penalties.
        Note: Don't give bonuses. It can result in negative chase times
              which can screw up the math later on. --Wils (06/25/11)
        """
        ballLocation = Location(self.brain.ball.x, self.brain.ball.y)
        headingBallToGoal = ballLocation.headingTo(OPP_GOAL)

        relLocToBall = RelRobotLocation(self.brain.ball.rel_x,
                                        self.brain.ball.rel_y,
                                        headingBallToGoal)

        time = self.determineTimeToDest(relLocToBall)

        # Give a penalty for not seeing the ball if we aren't in a kickingState
        if (self.brain.ball.vis.frames_off > 45 and # TODO: unify this constant with shouldFindBall
            not self.brain.player.inKickingState):
            time += BALL_OFF_PENALTY

        if DEBUG_DETERMINE_DEST_TIME:
            print "\tChase time after ball on bonus " + str(time)

        return time
开发者ID:bmende,项目名称:nbites,代码行数:28,代码来源:TeamMember.py

示例2: pLeftDeepBack

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pLeftDeepBack(team, workingPlay):
    """position deep right back"""
    workingPlay.setSubRole(PBConstants.LEFT_DEEP_BACK)
    dest = Location(PBConstants.DEEP_BACK_X, PBConstants.LEFT_DEEP_BACK_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.DEEP_BACK_X, PBConstants.LEFT_DEEP_BACK_Y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:9,代码来源:SubRoles.py

示例3: pOffensiveMiddie

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pOffensiveMiddie(team, workingPlay):
    workingPlay.setSubRole(PBConstants.OFFENSIVE_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_MIDDIE_Y, PBConstants.MAX_MIDDIE_Y)
    dest = Location(PBConstants.OFFENSIVE_MIDDIE_X, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (PBConstants.OFFENSIVE_MIDDIE_X, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:10,代码来源:SubRoles.py

示例4: pRightDeepBack

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pRightDeepBack(team, workingPlay):
    """position deep left back"""
    workingPlay.setSubRole(PBConstants.RIGHT_DEEP_BACK)
    dest = Location(PBConstants.DEEP_BACK_X,
                             PBConstants.RIGHT_DEEP_BACK_Y)
    h = dest.headingTo(Location(team.brain.ball.x, team.brain.ball.y))
    pos = (PBConstants.DEEP_BACK_X, PBConstants.RIGHT_DEEP_BACK_Y,h)
    workingPlay.setPosition(pos)
开发者ID:dmcavoy,项目名称:nbites,代码行数:10,代码来源:SubRoles.py

示例5: pDubDMiddie

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pDubDMiddie(team, workingPlay):
    """middie for when in dubD"""
    workingPlay.setSubRole(PBConstants.DUB_D_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_MIDDIE_Y, PBConstants.MAX_MIDDIE_Y)
    x = PBConstants.OFFENSIVE_MIDDIE_X
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:12,代码来源:SubRoles.py

示例6: pStopper

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pStopper(team, workingPlay):
    """position stopper"""
    workingPlay.setSubRole(PBConstants.STOPPER)
    x = PBConstants.STOPPER_X
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_STOPPER_Y, PBConstants.MAX_STOPPER_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:12,代码来源:SubRoles.py

示例7: pPicker

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pPicker(team, workingPlay):
    """position picker"""
    workingPlay.setSubRole(PBConstants.PICKER)
    x = PBConstants.PICKER_X
    y = PBConstants.PICKER_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x,y,h)
    workingPlay.setPosition(pos)
开发者ID:WangHanbin,项目名称:nbites,代码行数:12,代码来源:SubRoles.py

示例8: pCenterBack

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pCenterBack(team, workingPlay):
    """position center back"""
    workingPlay.setSubRole(PBConstants.CENTER_BACK)
    x, y = team.getPointBetweenBallAndGoal(team.brain.ball, PBConstants.DEFENDER_BALL_DIST)
    x = MyMath.clip(x, PBConstants.SWEEPER_X, PBConstants.STOPPER_X)
    y = MyMath.clip(y, PBConstants.MIN_CENTER_BACK_Y, PBConstants.MAX_CENTER_BACK_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:13,代码来源:SubRoles.py

示例9: pGoalieCenter

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pGoalieCenter(team, workingPlay):
    """normal goalie position in the center of the goal"""
    workingPlay.setSubRole(PBConstants.GOALIE_CENTER)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:13,代码来源:SubRoles.py

示例10: pGoalieSave

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pGoalieSave(team, workingPlay):
    """ goalie saving """
    workingPlay.setSubRole(PBConstants.GOALIE_SAVE)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:13,代码来源:SubRoles.py

示例11: strategize

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
    def strategize(self, play):
        """
        creates a play, picks the strategy to run, returns the play after
        it is modified by Strategies
        """
        currentGCState = self.brain.player.gameState
        # We don't control anything in initial or finished
        if (currentGCState == 'gameInitial' or
            currentGCState == 'gameFinished'):
            play.setRole(PBConstants.INIT_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Have a separate strategy to easily deal with being penalized
        elif not self.me.active:
            play.setRole(PBConstants.PENALTY_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Special case for the goalie
        if (self.me.isDefaultGoalie()):
            # Make sure the goalie's role is set
            play.setRole(PBConstants.GOALIE)
            dest = Location(PBConstants.GOALIE_HOME_X,
                            PBConstants.GOALIE_HOME_Y)
            h = dest.headingTo(Location(self.brain.ball.x, self.brain.ball.y))
            pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)
            play.setPosition(pos)
            return

        # Have a separate ready section to make things simpler
        if (currentGCState == 'gameReady' or currentGCState =='gameSet'):
            if (currentGCState == 'gameReady'):
                self.lastBallX = -1
                self.lastBallY = -1
            self.readyPosition(play)
            return

        # Update the current grid square that the ball is.
        self.ballUpdate()

        test = False
        # Check test cases
        if (PBConstants.TEST_DEFENDER or PBConstants.TEST_OFFENDER
            or PBConstants.TEST_MIDDIE or PBConstants.TEST_CHASER):
            test = True

        # Use the playbook table to determine position.
        self.priorityPositions(
            self.tableLookup(self.lastBallX, self.lastBallY, test) , play)
开发者ID:jzalinger,项目名称:nbites,代码行数:56,代码来源:GoTeam.py

示例12: pSweeper

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pSweeper(team, workingPlay):
    """position sweeper"""
    workingPlay.setSubRole(PBConstants.SWEEPER)
    x = PBConstants.SWEEPER_X
    y = PBConstants.SWEEPER_Y
    y += PBConstants.SWEEPER_Y_OFFSET * MyMath.sign(team.brain.ball.loc.y - NogginConstants.CENTER_FIELD_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:13,代码来源:SubRoles.py

示例13: pRightWing

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pRightWing(team, workingPlay):
    """position right winger"""
    workingPlay.setSubRole(PBConstants.RIGHT_WING)
    midpoint = (PBConstants.WING_MAX_X - PBConstants.WING_MIN_X) * 0.5
    scale = (PBConstants.WING_MAX_X - midpoint) / (PBConstants.PICKER_X_THRESH - midpoint)
    x = -1 * scale * (team.brain.ball.loc.x - midpoint)
    y = PBConstants.RIGHT_WING_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:14,代码来源:SubRoles.py

示例14: pGoalieChaser

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pGoalieChaser(team, workingPlay):
    """goalie is being a chaser, presumably in/near goalbox not intended for
        pulling the goalie situations"""
    workingPlay.setSubRole(PBConstants.GOALIE_CHASER)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
开发者ID:nerkis,项目名称:nbites,代码行数:14,代码来源:SubRoles.py

示例15: pForward

# 需要导入模块: from objects import Location [as 别名]
# 或者: from objects.Location import headingTo [as 别名]
def pForward(team, workingPlay):
    """position forward"""
    workingPlay.setSubRole(PBConstants.FORWARD)
    x = PBConstants.FORWARD_X
    if team.brain.ball.loc.y < NogginConstants.CENTER_FIELD_Y:
        y = PBConstants.LEFT_FORWARD_Y
    else:
        y = PBConstants.RIGHT_FORWARD_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
开发者ID:WangHanbin,项目名称:nbites,代码行数:15,代码来源:SubRoles.py


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