def calFirstIntentionConsistAfterNoise(trajectory, noisePoints, target1, target2, goalList): trajectory = list(map(tuple, trajectory)) afterNoiseGrid = trajectory[noisePoints] if isGridsALine(afterNoiseGrid, target1, target2): afterNoiseIntentionConsis = 1 if goalList[noisePoints] == calculateFirstIntention(goalList) else 0 else: afterNoiseIntentionConsis = 1 if goalList[noisePoints + 1] == calculateFirstIntention(goalList) else 0 return afterNoiseIntentionConsis
def __call__(self, trajectory, target1, target2, noisePoints, goalList): playerGrid = trajectory[noisePoints] targets = list([target1, target2]) originGoal = targets[calculateFirstIntention(goalList)] noGoal = [target for target in targets if target != originGoal][0] likelihoodGoal = self.goalPolicy(playerGrid, originGoal).get(action) likelihoodNoGoal = self.goalPolicy(playerGrid, noGoal).get(action) return [likelihoodGoal, likelihoodNoGoal]
def calFirstIntentionInConsistAfterNoise(noisePoints, goalList): afterNoiseGoalList = goalList[noisePoints:] afterNoiseIntentionInConsis = 1 if calculateFirstIntention(afterNoiseGoalList) != calculateFirstIntention(goalList) else 0 return afterNoiseIntentionInConsis