-
Notifications
You must be signed in to change notification settings - Fork 36
/
initrc
executable file
·108 lines (92 loc) · 2.83 KB
/
initrc
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
#! /bin/bash
# WrightEagle (Soccer Simulation League 2D)
# BASE SOURCE CODE RELEASE 2016
# Copyright (C) 1998-2016 WrightEagle 2D Soccer Simulation Team,
# Multi-Agent Systems Lab.,
# School of Computer Science and Technology,
# University of Science and Technology of China, China.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#$1: player unum, < 0 means run all player one by one
DYNAMICDEBUG_TXT="dynamicdebug.txt"
BINARY="WEBase"
TEAMNAME="WEBase"
COACH_UNUM="0"
GOALIE_UNUM="1"
TRAINER_UNUM="12"
VALGRIND="false" #true/false
GENLOG="off" #on/off
PLOTTER="off" #on/off
VERSION="Debug" #Debug/Release
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./lib"
run_one() {
if [ $# -lt 2 ]; then
echo "Error: wrong usage"
exit
fi
if [ $1 -ge 0 ]; then
echo "load Logfiles/$TEAMNAME-$1-msg.log" >${DYNAMICDEBUG_TXT}
if [ $2 = "true" ]; then
echo "r" >>${DYNAMICDEBUG_TXT}
fi
fi
PLAYER=$(cat ${DYNAMICDEBUG_TXT} | grep -o '\-[[:digit:]]\+\-' | grep -o '[[:digit:]]\+')
echo -en "\033[1mRunning player $PLAYER $VERSION"
OPTS="-dynamic_debug_mode on -use_plotter $PLOTTER -save_server_message off"
OPTS="$OPTS -save_sight_log $GENLOG -save_dec_log $GENLOG -save_text_log $GENLOG"
OPTS="$OPTS -time_test off -network_test off"
if [ $PLAYER -eq $COACH_UNUM ]; then
OPTS="$OPTS -coach on"
echo -n " -coach"
elif [ $PLAYER -eq $GOALIE_UNUM ]; then
OPTS="$OPTS -goalie on"
echo -n " -goalie"
elif [ $PLAYER -eq $TRAINER_UNUM ]; then
OPTS="$OPTS -trainer on"
echo -n " -trainer"
fi
echo -e "\033[0m"
if [ $VALGRIND = "true" ]; then
valgrind --leak-check=full ./$VERSION/$BINARY $OPTS 2>&1 | tee Logfiles/$TEAMNAME-$PLAYER-valgrind.log
else
./$VERSION/$BINARY $OPTS
fi
if [ $(ls core* 2>/dev/null | wc -l) -gt 0 ]; then
echo "core found, exit"
exit 1
fi
}
run() {
if [ $VERSION = "Debug" ]; then
make
elif [ $VERSION = "Release" ]; then
make release
else
echo "Warning: unknow version "$VERSION
fi
rm -f core*
ulimit -c unlimited
if [ ! -z $1 ]; then
if [ $1 -lt 0 ]; then
for i in $(seq 0 11); do
run_one $i true
done
else
run_one $1 false
fi
else
run_one -1 false
fi
}