diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2022-04-19 21:26:49 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2022-04-19 21:26:49 +0200 |
commit | 7ec48d0d454499177b63bc5bd512a3a2d6baa839 (patch) | |
tree | 23d34d45dbb3ae977710361501a3dde3544734d1 /2018-tower-defence/import-replay.sh | |
parent | 1e21ebed15321aacbba53121cb40bbc60f4db1cc (diff) |
Refile for merging repos
Diffstat (limited to '2018-tower-defence/import-replay.sh')
-rwxr-xr-x | 2018-tower-defence/import-replay.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/2018-tower-defence/import-replay.sh b/2018-tower-defence/import-replay.sh new file mode 100755 index 0000000..2a1b27e --- /dev/null +++ b/2018-tower-defence/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 |