Skip to content

Commit

Permalink
Changed .size() to len() for homePos and awayPos
Browse files Browse the repository at this point in the history
awayPos and homePos have no attribute called size. So changed it to len(state.awayPos) and len(state.homePos)
  • Loading branch information
thebhatman authored Jun 24, 2019
1 parent 6fe6ee9 commit c460283
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/state_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def closest_opponent(state, position):
def our_bot_closest_to_ball(state):
distance_from_ball = 99999999
our_bot_closest_to_ball = 0
for i in range(state.homePos.size()):
for i in range(len(state.homePos)):
dist = math.sqrt(pow((state.homePos[i].x - state.ballPos.x),2) + pow((state.homePos[i].y - state.ballPos.y) , 2))
if dist < distance_from_ball :
distance_from_ball = dist
Expand All @@ -95,7 +95,7 @@ def our_bot_closest_to_ball(state):
def opp_bot_closest_to_ball(state):
distance_from_ball = 99999999
opp_bot_closest_to_ball = 0
for i in range(state.awayPos.size()):
for i in range(len(state.awayPos)):
dist = math.sqrt(pow((state.awayPos[i].x - state.ballPos.x),2) + pow((state.awayPos[i].y - state.ballPos.y) , 2))
if dist < distance_from_ball :
distance_from_ball = dist
Expand Down

0 comments on commit c460283

Please sign in to comment.