-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute-ia-player.sh
executable file
·40 lines (30 loc) · 1 KB
/
execute-ia-player.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
#!/usr/bin/bash
TERMFS=10
SPORT=$(( ( RANDOM % 1000 ) + 2000 ))
PPORT1=$(( ( RANDOM % 1000 ) + 3000 ))
PPORT2=$(( ( RANDOM % 1000 ) + 4000 ))
OPORT2=$(( ( RANDOM % 1000 ) + 6000 ))
IA1=$1
if test x$IA1 = x; then
echo "usage: $0 <ia1>"
exit 1
fi
source ./execute-lib.sh ; cd ..
make_empire
# Demarrage des programmes.
launch_xterm "./empire-server/Main.native -sport ${SPORT} 2>&1 | tee out_S" SPID 0 0
launch_xterm "./empire-client/Main.native -sport ${SPORT}" PPID1 485 0
launch_xterm "./empire-tee/tee.py localhost ${SPORT} ${PPORT2} ${OPORT2}" TPID2 0 370
launch_xterm "./empire-client/Main.native -obs -sport ${OPORT2}" OPID2 485 370
launch_xterm "./empire-captain/ai${IA1}.py localhost ${PPORT2} | tee out_P2" PPID2 970 370
PIDS="${SPID} ${TPID1} ${PPID1} ${TPID2} ${OPID2} ${PPID2}"
# Regarde si un des programmes est stoppe.
STOPPED=0
while test $STOPPED -eq 0; do
sleep 2
check_processes STOPPED ${PIDS}
done
echo "Kill xterms (press a key)"
read n
# Arret de tous les programmes.
stop_processes ${PIDS}