Commit 7435a741 authored by drallensmith's avatar drallensmith

Trying to figure out agent-as-goalie problem

parent 1c57d3f1
#!/bin/bash
./bin/HFO --offense-npcs=2 --defense-agents=1 --defense-npcs=2 --trials 20 --headless &
sleep 5
./example/hand_coded_defense_agent.py &> agent1.txt &
sleep 5
# The magic line
# $$ holds the PID for this script
# Negation means kill by process group id instead of PID
trap "kill -TERM -$$" SIGINT
wait
\ No newline at end of file
......@@ -221,12 +221,22 @@ def main():
print("Python randomization seed useless without --epsilon >0")
if args.epsilon > 0:
print("Using epsilon {0:n}".format(args.epsilon))
my_unum = hfo_env.getUnum()
assert ((my_unum > 1) and (my_unum <= 11)), "Bad unum {!r}".format(my_unum)
print("My unum is {0:d}".format(my_unum))
for episode in itertools.count():
old_ball_pos_x = 0
old_ball_pos_x = -1
old_ball_pos_y = 0
episode_start = True
status = hfo.IN_GAME
while status == hfo.IN_GAME:
state = hfo_env.getState()
if episode_start:
if (state[3] >= -1) and (state[3] <= 1):
old_ball_pos_x = state[3]
if (state[4] >= -1) and (state[4] <= 1):
old_ball_pos_y = state[4]
episode_start = False
if (args.epsilon > 0) and (random.random() < args.epsilon):
do_random_defense_action(state, hfo_env)
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