summaryrefslogtreecommitdiff
path: root/import-replay.sh
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-06-02 13:09:13 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-06-02 13:09:13 +0200
commitbb208dfdebb7dead0e7d68e837c37972498c22d5 (patch)
treebca12d92b906ea0da68cfc8b12f270176604dbe6 /import-replay.sh
parenta81a55fd129b947c347284e271d4c6b214c51068 (diff)
Moved replay-based test to have convenience import from game engine replay
Diffstat (limited to 'import-replay.sh')
-rwxr-xr-ximport-replay.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/import-replay.sh b/import-replay.sh
new file mode 100755
index 0000000..2a1b27e
--- /dev/null
+++ b/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/*; do
+ round_name=`basename "$round_folder"`
+ mkdir -p "$OUTPUT_FOLDER/$round_name"
+
+ player_folders=( "$round_folder"/* )
+ player_folder=${player_folders[0]}
+ cp "$player_folder/JsonMap.json" "$OUTPUT_FOLDER/$round_name/state.json"
+ cp "$player_folder/PlayerCommand.txt" "$OUTPUT_FOLDER/$round_name/PlayerCommand.txt"
+
+ opponent_folder=${player_folders[1]}
+ cp "$opponent_folder/PlayerCommand.txt" "$OUTPUT_FOLDER/$round_name/OpponentCommand.txt"
+done