Commit 52b11c2c authored by drallensmith's avatar drallensmith

Improved calling of Reorient in high_action_random_agent.py

parent bdeb5ecc
...@@ -47,15 +47,18 @@ def main(): ...@@ -47,15 +47,18 @@ def main():
# Get the vector of state features for the current state # Get the vector of state features for the current state
state = hfo_env.getState() state = hfo_env.getState()
# Perform the action # Perform the action
if state[12] > 0: # State[12] is 1 when the player can kick the ball # 8 is frozen; 0 is self position valid, 1 is self velocity valid, 54 is ball velocity valid
if (((state[8] > 0) or (min(state[0],state[1],state[54]) < 0)) and not args.no_reorient):
hfo_env.act(hfo.REORIENT)
num_reorient += 1
elif state[12] > 0: # State[12] is 1 when the player can kick the ball
if random.random() < 0.5: # more efficient than random.choice for 2 if random.random() < 0.5: # more efficient than random.choice for 2
hfo_env.act(hfo.SHOOT) hfo_env.act(hfo.SHOOT)
else: else:
hfo_env.act(hfo.DRIBBLE) hfo_env.act(hfo.DRIBBLE)
num_had_ball += 1 num_had_ball += 1
# 8 is frozen; rest are self or ball position/velocity valid # 50 is ball position valild
elif (((state[8] > 0) or (min(state[0],state[1],state[50],state[54]) < 0)) and elif (state[50] < 0) and not args.no_reorient:
not args.no_reorient):
hfo_env.act(hfo.REORIENT) hfo_env.act(hfo.REORIENT)
num_reorient += 1 num_reorient += 1
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment