-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunAllBots.sh
More file actions
executable file
·41 lines (31 loc) · 848 Bytes
/
Copy pathrunAllBots.sh
File metadata and controls
executable file
·41 lines (31 loc) · 848 Bytes
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
#!/bin/bash
width=$(( 10 * (2 + $RANDOM % 5)))
height=$(( 10 * (2 + $RANDOM % 5)))
dimensions="$width $height"
arr=(./bots/*)
playerScores=()
# delete unneeded files from directory
for f in "${arr[@]}"; do
if [ $f = "./bots/hlt.py" ]
then
arr=( "${arr[@]/$f}" )
elif [ $f = "./bots/__pycache__" ]
then
arr=( "${arr[@]/$f}" )
else
playerScores+=( 0 )
fi
done
echo "${arr[@]}"
length=$((${#arr[@]}-2))
for i in {1..5}
do
randomVal=$(($RANDOM % $length))
randomVal2=$((randomVal + 1+$RANDOM % ($length - 1)))
player1=${arr[$randomVal]}
player2=${arr[$(($randomVal2 % $length))]}
output=$(./halite -d "$dimensions" "python3 $player1" "python3 $player2" -q)
echo "$output" >> output.txt
echo "completed match: $i with dimensions: $dimensions"
done
echo "Player Scores: ${#playerScores[@]}"