forked from LARG/utaustinvilla3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·139 lines (117 loc) · 3.6 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
#
# UT Austin Villa start script for 3D Simulation Competitions
#
AGENT_BINARY=agentspark
BINARY_DIR="."
LIBS_DIR="./libs"
NUM_PLAYERS=11
team="UTAustinVilla_Base"
host="localhost"
port=3100
paramsfile=paramfiles/defaultParams.txt
mhost="localhost"
export LD_LIBRARY_PATH=$LIBS_DIR:$LD_LIBRARY_PATH
usage()
{
(echo "Usage: $0 [options]"
echo "Available options:"
echo " --help prints this"
echo " HOST specifies server host (default: localhost)"
echo " -p, --port PORT specifies server port (default: 3100)"
echo " -t, --team TEAMNAME specifies team name"
echo " -mh, --mhost HOST IP of the monitor for sending draw commands (default: localhost)"
echo " -pf, --paramsfile FILENAME name of a parameters file to be loaded (default: paramfiles/defaultParams.txt)") 1>&2
}
fParsedHost=false
paramsfile_args="--paramsfile ${paramsfile}"
while [ $# -gt 0 ]
do
case $1 in
--help)
usage
exit 0
;;
-mh|--mhost)
if [ $# -lt 2 ]; then
usage
exit 1
fi
mhost="${2}"
shift 1
;;
-p|--port)
if [ $# -lt 2 ]; then
usage
exit 1
fi
port="${2}"
shift 1
;;
-t|--team)
if [ $# -lt 2 ]; then
usage
exit 1
fi
team="${2}"
shift 1
;;
-pf|--paramsfile)
if [ $# -lt 2 ]; then
usage
exit 1
fi
DIR_PARAMS="$( cd "$( dirname "$2" )" && pwd )"
PARAMS_FILE=$DIR_PARAMS/$(basename $2)
paramsfile_args="${paramsfile_args} --paramsfile ${PARAMS_FILE}"
shift 1
;;
*)
if $fParsedHost;
then
echo 1>&2
echo "invalid option \"${1}\"." 1>&2
echo 1>&2
usage
exit 1
else
host="${1}"
fParsedHost=true
fi
;;
esac
shift 1
done
opt="${opt} --host=${host} --port ${port} --team ${team} ${paramsfile_args} --mhost=${mhost}"
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR
for ((i=1;i<=$NUM_PLAYERS;i++)); do
case $i in
1|2)
echo "Running agent No. $i -- Type 0"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 0 --paramsfile paramfiles/defaultParams_t0.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 0 --paramsfile paramfiles/defaultParams_t0.txt > stdout$i 2> stderr$i &
;;
3|4)
echo "Running agent No. $i -- Type 1"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 1 --paramsfile paramfiles/defaultParams_t1.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 1 --paramsfile paramfiles/defaultParams_t1.txt > stdout$i 2> stderr$i &
;;
5|6)
echo "Running agent No. $i -- Type 2"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 2 --paramsfile paramfiles/defaultParams_t2.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 2 --paramsfile paramfiles/defaultParams_t2.txt > stdout$i 2> stderr$i &
;;
7|8)
echo "Running agent No. $i -- Type 3"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 3 --paramsfile paramfiles/defaultParams_t3.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 3 --paramsfile paramfiles/defaultParams_t3.txt > stdout$i 2> stderr$i &
;;
*)
echo "Running agent No. $i -- Type 4"
"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 4 --paramsfile paramfiles/defaultParams_t4.txt &#> /dev/null &
#"$BINARY_DIR/$AGENT_BINARY" $opt --unum $i --type 4 --paramsfile paramfiles/defaultParams_t4.txt > stdout$i 2> stderr$i &
;;
esac
sleep 1
done