summaryrefslogtreecommitdiff
path: root/tests/import-replay.sh
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2020-04-18 17:45:28 +0200
committerJustin Wernick <justin@worthe-it.co.za>2020-04-18 17:45:28 +0200
commit5009074b5ba323e5312e999d766a01120990a61e (patch)
treecaf5c02671bd36b376be0d6d61bc9817d072d9d4 /tests/import-replay.sh
parent80485b855c5628adc2fa619de21164ded1a0cae1 (diff)
Tests comparing against a replay, and fixing the found bugs
Diffstat (limited to 'tests/import-replay.sh')
-rwxr-xr-xtests/import-replay.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/import-replay.sh b/tests/import-replay.sh
new file mode 100755
index 0000000..c2da003
--- /dev/null
+++ b/tests/import-replay.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+REPLAY_FOLDER=$1
+OUTPUT_FOLDER=$2
+
+mkdir -p $OUTPUT_FOLDER
+
+for round_folder in $REPLAY_FOLDER/Round*; do
+ round_name=`basename "$round_folder"`
+ mkdir -p "$OUTPUT_FOLDER/$round_name"
+
+ player_folders=( "$round_folder"/* )
+ player_folder=${player_folders[0]}
+ opponent_folder=${player_folders[1]}
+
+ cp "$player_folder/JsonMap.json" "$OUTPUT_FOLDER/$round_name/JsonMap.json"
+ head -n 1 "$player_folder/PlayerCommand.txt" > "$OUTPUT_FOLDER/$round_name/PlayerCommand.txt"
+ head -n 1 "$opponent_folder/PlayerCommand.txt" > "$OUTPUT_FOLDER/$round_name/OpponentCommand.txt"
+done