def sidePass(player): if player.firstFrame(): player.passBack = True if roleConstants.isFirstChaser(player.role): decider = KickDecider.KickDecider(player.brain) passDest = Location(nogginC.MIDFIELD_X + constants.SIDE_PASS_OFFSET, 0.) player.kick = decider.sweetMovesForKickOff(-1, passDest) player.inKickingState = True return player.goNow('approachBall') elif roleConstants.isSecondChaser(player.role) or roleConstants.isCherryPicker(player.role): pass else: return player.goNow('playOffBall') return player.stay() if constants.sidePassFinished(player): if constants.isSeeingBall(player): return player.goNow('passToFieldCross') elif constants.didNotRecieveSidePass(player): player.passBack = False player.inKickOffPlay = False return player.goNow('findBall') return player.stay()
def passToCorner(player): if player.firstFrame(): player.passBack = True if roleConstants.isFirstChaser(player.role): corner = Location(nogginC.FIELD_WHITE_WIDTH, 0.) decider = KickDecider.KickDecider(player.brain) player.kick = decider.sweetMovesForKickOff(0, corner) player.inKickingState = True return player.goNow('approachBall') elif roleConstants.isSecondChaser(player.role) or roleConstants.isCherryPicker(player.role): player.brain.tracker.repeatFastTwoIntervalPan() passDestination = Location(nogginC.OPP_GOALBOX_LEFT_X, 60.) player.brain.nav.goTo(passDestination, Navigator.GENERAL_AREA, speeds.SPEED_EIGHT, True, False, True, False) else: return player.goNow('playOffBall') return player.stay() elif constants.shouldPassToFieldCross(player): return player.goNow('passToFieldCross') elif constants.ballNotPassedToCorner(player): player.passBack = False player.inKickOffPlay = False return player.goNow('findBall') else: passDestination = Location(nogginC.OPP_GOALBOX_LEFT_X, 60.) player.brain.nav.updateDest(passDestination) return player.stay()
def passToFieldCross(player): if player.firstFrame(): player.passBack = False if roleConstants.isFirstChaser(player.role): player.brain.tracker.repeatFastTwoIntervalPan() fieldCross = Location(nogginC.LANDMARK_OPP_FIELD_CROSS[0], nogginC.LANDMARK_OPP_FIELD_CROSS[1]) player.brain.nav.goTo(fieldCross, Navigator.GENERAL_AREA, speeds.SPEED_EIGHT, True, False, True, False) elif roleConstants.isSecondChaser(player.role) or roleConstants.isCherryPicker(player.role): if not constants.ballIsLost(player): decider = KickDecider.KickDecider(player.brain) # player.kick = decider.bigKicksOnGoal() # player.kick = decider.sweetMovesOnGoal() # player.kick = decider.sweetMoveCrossToCenter() player.kick = decider.decidingStrategy() player.finishedPlay = True player.inKickingState = True return player.goNow('approachBall') else: player.inKickOffPlay = False return player.goNow('findBall') else: return player.goNow('playOffBall') return player.stay() if roleConstants.isFirstChaser(player.role): fieldCross = Location(nogginC.LANDMARK_OPP_FIELD_CROSS[0], nogginC.LANDMARK_OPP_FIELD_CROSS[1]) player.brain.nav.updateDest(fieldCross) if constants.shouldStopWalkingToCross(player): player.inKickOffPlay = False return player.goNow('approachBall') return player.stay()
def gamePlaying(player): if player.firstFrame(): player.inKickingState = False player.inKickOffPlay = (kickOff.shouldRunKickOffPlay(player) and (roleConstants.isChaser(player.role) or roleConstants.isCherryPicker(player.role))) player.passBack = False player.brain.fallController.enabled = True player.brain.nav.stand() player.brain.tracker.trackBall() # TODO without pb, is this an issue? # if (player.lastDiffState == 'afterPenalty' and # player.brain.play.isChaser()): # # special behavior case # return player.goNow('postPenaltyChaser') # Wait until the sensors are calibrated before moving. if player.wasPenalized: player.wasPenalized = False return player.goNow('afterPenalty') if not player.brain.motion.calibrated: return player.stay() if player.brain.gameController.timeSincePlaying < 10: if player.brain.gameController.ownKickOff: if roleConstants.isChaser(player.role) or roleConstants.isCherryPicker(player.role): player.shouldKickOff = True return player.goNow('approachBall') else: return player.goNow('playOffBall') else: return player.goNow('waitForKickoff') return player.goNow('playOffBall')