Esempio n. 1
0
    def takeStep(self, myTeam=[], enemyTeam=[], balls=[], obstacles=[], drawRadius=20):
        actions = []
        deltaPos = np.array([1, 0, 0])
        nearestUnstunnedAgent = findNearestUnstunned(enemyTeam)
        stunMovement = array([0, 0, 0])
        if nearestUnstunnedAgent.isStunned and nearestUnstunnedAgent.isDead:
            stunMovement = array([0, 0, 0])
        else:
            stunMovement = nearestUnstunnedAgent.position

        avoidObstacleMovement = getObstacleAvoidance(obstacles)
        avoidTeamMovement = getTeamAvoidance(myTeam)

        if drawRadius < 1.5 * nearestUnstunnedAgent.drawRadius:
            stunWeight = 0
        elif drawRadius < nearestUnstunnedAgent.drawRadius:
            stunWeight = 5
        elif drawRadius > 2 * nearestUnstunnedAgent.drawRadius:
            stunWeight = 80
        else:
            stunWeight = 40

        movement = normalize(
            stunWeight * stunMovement
            + 10 * avoidObstacleMovement
            + 10 * avoidTeamMovement
            + 10000 * getRestrictionField(obstacles[0], 1000)
        )
        deltaRot = getYPRFromVector(movement)
        actions.append(Stun(nearestUnstunnedAgent, 100000))

        return deltaPos, deltaRot, actions
Esempio n. 2
0
    def takeStep(self, myTeam=[], enemyTeam=[], balls=[], obstacles=[]):
        actions = []
        deltaPos = np.array([1, 0, 0])
        nearestUnstunnedAgent = findNearestUnstunned(enemyTeam)
        stunMovement = array([0, 0, 0])
        if nearestUnstunnedAgent.isStunned:
            stunMovement  = array([0, 0, 0])
        else:
            stunMovement = nearestUnstunnedAgent.position

        avoidObstacleMovement = getObstacleAvoidance(obstacles)
        avoidTeamMovement = getTeamAvoidance(myTeam)

        movement = normalize(1.5*stunMovement + 0.5*avoidObstacleMovement + 0.5*avoidTeamMovement)
        deltaRot = getYPRFromVector(movement)
        actions.append(Stun(nearestUnstunnedAgent, 5))

        return deltaPos, deltaRot, actions