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


Python RoleConstants.setRoleConstants方法代码示例

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


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

示例1: determineRole

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def determineRole(player):
    if not player.roleSwitching:
        return player.goLater(player.gameState)

    openSpaces = [True, True, True, True]
    for mate in player.brain.teamMembers:
        if mate.playerNumber == player.brain.playerNumber:
            continue
        if not roleConstants.isGoalie(mate.role) \
                and mate.frameSinceActive < 30:
            openSpaces[mate.role - 2] = False

    position = 0

    for i in range(4):
        if openSpaces[i] and roleConstants.canRoleSwitchTo(i+2):
            roleConstants.setRoleConstants(player, i+2)
            return player.goLater(player.gameState)
        elif openSpaces[i]:
            position = i+2

    if position == 0:
        print "Came out of penalty and found no open spaces!!!"

    roleConstants.setRoleConstants(player, i+2)
    return player.goLater(player.gameState)
开发者ID:dnav6987,项目名称:nbites,代码行数:28,代码来源:PenaltyStates.py

示例2: switchRoles

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def switchRoles(player):
    """
    State to decide who on the team should become the new chaser and switch accordingly.
    """
    roleConstants.setRoleConstants(player, player.openChaser)

    return player.goLater(player.gameState)
开发者ID:CheddarB,项目名称:nbites,代码行数:9,代码来源:RoleSwitchingStates.py

示例3: checkForConsistency

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def checkForConsistency(player):
    """
    Checks to see if anyone else has the same role as us. If they also have
    a lower playerNumber then we change. Otherwise we assume that they will
    fix the issue. Very similar in structure to determineRole in penalty states.
    """
    if not player.roleSwitching:
        return

    openSpaces = [True, True, True, True]
    conflict = False
    position = 0

    for mate in player.brain.teamMembers:
        if mate.playerNumber == player.brain.playerNumber:
            continue
        openSpaces[mate.role - 2] = False
        if mate.role == player.role and mate.playerNumber > player.brain.playerNumber and mate.frameSinceActive < 30:
            conflict = True

    if not conflict:
        return  # The expected outcome

    for i in range(3):
        if openSpaces[i] and constants.canRoleSwitchTo(i + 2):
            constants.setRoleConstants(player, i + 2)
            return
        elif openSpaces[i]:
            position = i + 2

    if position == 0:
        print "We have conflicting role AND there are no more open roles..."

    constants.setRoleConstants(player, position)
    return
开发者ID:nbitesGuest,项目名称:nbites,代码行数:37,代码来源:RoleSwitchingTransitions.py

示例4: switchRoles

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def switchRoles(player):
    """
    State to decide who on the team should become the new chaser and switch accordingly.
    """
    # US Open Hack
    if player.brain.game:
        oppTeam = player.brain.game.team(1).team_number
    else:
        oppTeam = -1
    roleConstants.setRoleConstants(player, player.openChaser, oppTeam)

    return player.goLater(player.gameState)
开发者ID:bill-silver,项目名称:nbites,代码行数:14,代码来源:RoleSwitchingStates.py

示例5: commMonitor

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def commMonitor(player):
    if player.commMode == -1:
        pass
    elif player.commMode != 2 and transitions.awfulComm(player):
        print "Switched to awful comm mode!"
        player.role = player.brain.playerNumber
        player.prevRoleConfig = RoleConstants.roleConfiguration
        RoleConstants.roleConfiguration = RoleConstants.spread
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = False
        player.commMode = 2
开发者ID:coryalini,项目名称:nbites,代码行数:15,代码来源:CommMonitorStates.py

示例6: commMonitor

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def commMonitor(player):
    if player.commMode == -1:
        pass
    elif player.commMode != 2 and transitions.awfulComm(player):
        print "Switched to awful comm mode!"
        player.role = player.brain.playerNumber
        player.prevRoleConfig = RoleConstants.roleConfiguration
        RoleConstants.roleConfiguration = RoleConstants.cautious
        RoleConstants.oddDefenderBox = RoleConstants.oddDefenderBoxCautious
        RoleConstants.evenDefenderBox = RoleConstants.evenDefenderBoxCautious
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = False
        player.commMode = 2
    elif player.commMode != 1 and transitions.mediocreComm(player):
        print "Switched to mediocre comm mode!"
        player.role = player.brain.playerNumber
        if player.commMode == 2:
            RoleConstants.roleConfiguration = player.prevRoleConfig
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = False
        player.commMode = 1
    elif player.commMode != 0 and transitions.goodComm(player):
        print "Switched to good comm mode!"
        player.role = player.brain.playerNumber
        if player.commMode == 2:
            RoleConstants.roleConfiguration = player.prevRoleConfig
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = True
        player.commMode = 0
开发者ID:nmorin,项目名称:nbites,代码行数:35,代码来源:CommMonitorStates.py

示例7: commMonitor

# 需要导入模块: import RoleConstants [as 别名]
# 或者: from RoleConstants import setRoleConstants [as 别名]
def commMonitor(player):
    if player.commMode == -1:
        pass
    elif player.commMode != 0 and player.brain.game.have_remote_gc:
        print "Switched to good comm mode because we are on the GC BABAY!"
        player.role = player.brain.playerNumber
        if player.commMode == 2: 
            RoleConstants.roleConfiguration = player.prevRoleConfig
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = True
        player.commMode = 0
    elif not player.brain.game.have_remote_gc and player.commMode != 2 and transitions.awfulComm(player):
        print "Switched to awful comm mode!"
        player.role = player.brain.playerNumber
        player.prevRoleConfig = RoleConstants.roleConfiguration
        RoleConstants.roleConfiguration = RoleConstants.spread
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = False
        player.commMode = 2
    elif not player.brain.game.have_remote_gc and player.commMode != 1 and transitions.mediocreComm(player):
        print "Switched to mediocre comm mode!"
        player.role = player.brain.playerNumber
        if player.commMode == 2: 
            RoleConstants.roleConfiguration = player.prevRoleConfig
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = False
        player.commMode = 1
    elif player.commMode != 0 and transitions.goodComm(player):
        print "Switched to good comm mode!"
        player.role = player.brain.playerNumber
        if player.commMode == 2: 
            RoleConstants.roleConfiguration = player.prevRoleConfig
        RoleConstants.oddDefenderBox = RoleConstants.defenderBox
        RoleConstants.evenDefenderBox = RoleConstants.defenderBox
        RoleConstants.setRoleConstants(player, player.role)
        player.roleSwitching = True
        player.commMode = 0
开发者ID:MarcusEFC,项目名称:nbites,代码行数:45,代码来源:CommMonitorStates.py


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