Commit 944de933 authored by drallensmith's avatar drallensmith

Initial try on improving MARK_PLAYER

parent 889fd855
#!/bin/bash
# HAS TO BE RUN FROM EXAMPLE DIR DUE TO hand_coded_defense_agent CONFIG!
../bin/HFO --offense-npcs=2 --defense-agents=1 --defense-npcs=1 --trials 20 --headless --port=7000 &
sleep 5
./hand_coded_defense_agent &> 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
...@@ -804,10 +804,12 @@ bool Agent::doMarkPlayer(int unum) { ...@@ -804,10 +804,12 @@ bool Agent::doMarkPlayer(int unum) {
int count = 0; int count = 0;
for ( PlayerPtrCont::const_iterator it = wm.opponentsFromSelf().begin(); it != o_end; ++it ) { for ( PlayerPtrCont::const_iterator it = wm.opponentsFromSelf().begin(); it != o_end; ++it ) {
if ( (*it)->distFromBall() < 5 ) { if ( (*it)->distFromBall() < 5 ) {
if ((kicker_unum == -1) || (kicker_unum != unum)) { // try to obey action instruction
kicker_pos = (*it)->pos(); kicker_pos = (*it)->pos();
kicker_unum = (*it)->unum(); kicker_unum = (*it)->unum();
} }
} }
}
for ( PlayerPtrCont::const_iterator it = wm.opponentsFromSelf().begin(); it != o_end; ++it ) { for ( PlayerPtrCont::const_iterator it = wm.opponentsFromSelf().begin(); it != o_end; ++it ) {
if ( (*it)-> unum() == unum ) { if ( (*it)-> unum() == unum ) {
......
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