Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes issue when only one post can be seen.

  • Loading branch information...
commit fe6ca81ceebaf14aa0c80faf87984c3e4be9ae7b 1 parent 37756c0
Josh Zalinger jzalinger authored
Showing with 42 additions and 34 deletions.
  1. +42 −34 src/man/noggin/kickDecider/HackKickInformation.py
76 src/man/noggin/kickDecider/HackKickInformation.py
View
@@ -182,45 +182,53 @@ def shoot(self):
# less than 40 degrees of goal available to shoot in.
leftScorePoint = ((rightPostBearing + leftPostBearing) / 2) + 5
rightScorePoint = leftScorePoint - 10
+ elif rightPostBearing is not None:
+ # Can only see the right post.
+ leftScorePoint = rightPostBearing - 15
+ rightScorePoint = leftScorePoint - 10
+ else:
+ # Can only see the left post.
+ rightScorePoint = leftPostBearing + 15
+ leftScorePoint = rightScorePoint +10
- # If any kick is currently valid, choose that kick.
- if leftScorePoint > 0 and rightScorePoint < 0:
- return self.chooseDynamicKick()
- elif leftScorePoint > 90 and rightScorePoint < 90:
- return kicks.RIGHT_SIDE_KICK
- elif leftScorePoint > -90 and rightScorePoint < -90:
- return kicks.LEFT_SIDE_KICK
- elif leftScorePoint > -180 and rightScorePoint < 180:
- return self.chooseBackKick()
+ # If any kick is currently valid, choose that kick.
+ if leftScorePoint > 0 and rightScorePoint < 0:
+ return self.chooseDynamicKick()
+ elif leftScorePoint > 90 and rightScorePoint < 90:
+ return kicks.RIGHT_SIDE_KICK
+ elif leftScorePoint > -90 and rightScorePoint < -90:
+ return kicks.LEFT_SIDE_KICK
+ elif leftScorePoint > -180 and rightScorePoint < 180:
+ return self.chooseBackKick()
- # Choose whichever kick is closest to being between the score points.
- # Note: no kick bearing is between the posts, so they are all
- # to the right of the rightScorePoint or left of leftScorePoint.
- if rightScorePoint > 90:
+ # Choose whichever kick is closest to being between the score points.
+ # Note: no kick bearing is between the posts, so they are all
+ # to the right of the rightScorePoint or left of leftScorePoint.
+ if rightScorePoint > 90:
# Quadrent 2
- if (180 - leftScorePoint) - (rightScorePoint - 90) < 0:
+ if (180 - leftScorePoint) - (rightScorePoint - 90) < 0:
#Closer to the leftScorePoint
- return self.chooseBackKick()
- else:
- return kicks.RIGHT_SIDE_KICK
- elif rightScorePoint > 0:
- # Quadrent 1
- if (90 - leftScorePoint) - (rightScorePoint - 0) < 0:
- return kicks.RIGHT_SIDE_KICK
- else:
- return self.chooseDynamicKick()
- elif rightScorePoint > -90:
- # Quadrent 4
- if (0 - leftScorePoint) - (rightScorePoint + 90) < 0:
- return self.chooseDynamicKick()
- else:
- return kicks.LEFT_SIDE_KICK
+ return self.chooseBackKick()
else:
- # Quadrent 3
- if (-90 - leftScorePoint) - (rightScorePoint + 180) < 0:
- return kicks.LEFT_SIDE_KICK
- else:
- return self.chooseBackKick()
+ return kicks.RIGHT_SIDE_KICK
+ elif rightScorePoint > 0:
+ # Quadrent 1
+ if (90 - leftScorePoint) - (rightScorePoint - 0) < 0:
+ return kicks.RIGHT_SIDE_KICK
+ else:
+ return self.chooseDynamicKick()
+ elif rightScorePoint > -90:
+ # Quadrent 4
+ if (0 - leftScorePoint) - (rightScorePoint + 90) < 0:
+ return self.chooseDynamicKick()
+ else:
+ return kicks.LEFT_SIDE_KICK
+ else:
+ # Quadrent 3
+ if (-90 - leftScorePoint) - (rightScorePoint + 180) < 0:
+ return kicks.LEFT_SIDE_KICK
+ else:
+ return self.chooseBackKick()
# if none were seen
return self.kickLoc()
Please sign in to comment.
Something went wrong with that request. Please try again.