-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
52 lines (47 loc) · 1.56 KB
/
run_tests.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
# **************************************************************************** #
# #
# ::: :::::::: #
# run_tests.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: zbatik <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/07/28 11:36:14 by zbatik #+# #+# #
# Updated: 2018/07/30 10:55:19 by zbatik ### ########.fr #
# #
# **************************************************************************** #
play_filler () {
echo PLAYING\ AGAINSTS\ $1\ ON\ MAP\ $2 >> result.log
wins=0
for count in {1..5}
do
p1=$((1 + $RANDOM % 2))
if [ $p1 == 1 ]; then
p2=2
else
p2=1
fi
./filler_vm -p$p1 $3 -p$p2 ./players/$1.filler -q -f ./maps/map0$2
winner=$(sed -n '2p' filler.trace)
echo $winner >> result.log
if [ "$winner" == "$3 won" ]; then
wins=$(echo $wins + 1 | bc)
fi
if [ $wins == 3 ]; then
break
fi
done
}
echo Please enter your filler name:
echo example:
echo ./me.filler
read filler
rm result.log
touch result.log
players='champely abanlin hcao grati carli superjeannot'
for player in $players
do
for map in {0..2}
do
play_filler $player $map $filler
done
done