aboutsummaryrefslogtreecommitdiff
path: root/fullcomp.sh
blob: 66609d9f74ca9e061cc741186db6ea03fd1998af (plain)
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
#!/usr/bin/env bash
BINARIES="./gluon ./neutrino ./randino"

if [[ ! -e competitions ]]; then
	mkdir competitions || exit 1
fi

find competitions -type f -delete

for p1 in $BINARIES; do
	for p2 in $BINARIES; do
		if [[ $p1 == $p2 ]]; then
			continue
		fi
		printf "%s\n%s\n" $p1 $p2 >competition.txt
		./competition.py $@
		status=$?
		if [[ $status != 0 ]]; then
			echo "$p1 - $p2 : ERROR $status     (0-0)"
			continue
		fi
		p1pretty=$(echo "$p1" | sed 's/[^a-zA-Z0-9 ]//g')
		p2pretty=$(echo "$p2" | sed 's/[^a-zA-Z0-9 ]//g')
		complogfile="competitions/game_${p1pretty}_vs_${p2pretty}.txt"
		lastline=$(tail -n1 $complogfile)
		if [[ "$lastline" == "P1 won" ]]; then
			echo "$p1 - $p2 : WIN - LOSS (3-1)"
		elif [[ "$lastline" == "P2 won" ]]; then
			echo "$p1 - $p2 : LOSS - WIN (1-3)"
		elif [[ "$lastline" == "Tie" ]]; then
			echo "$p1 - $p1 :    TIE     (1-1)"
		fi
	done
done

./fullcompstats.py