diff --git a/5/2/solution.sh b/5/2/solution.sh index 0cddff4..53f04d8 100755 --- a/5/2/solution.sh +++ b/5/2/solution.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# INCOMPLETE + set -o errexit set -o nounset set -o pipefail @@ -7,89 +9,89 @@ if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi -cd "$(dirname "$0")" - INPUT_FILE="$1" -get_seed_pairs () +gen_maps () { - IFS=" " read -r -a seeds <<< "$(grep seeds "${INPUT_FILE}" | cut -d ' ' -f 2-)" - seed_count="${#seeds[@]}" - pairs=$((seed_count/2)) - for ((i=0; i "${map_name}.map" - maps+=("${map_name}.map") + local seed_count pair_count i_start i_length start length end + IFS=" " read -r -a seeds <<< "$(grep seeds "${INPUT_FILE}" | cut -d ' ' -f 2-)" + seed_count="${#seeds[@]}" + pair_count=$((seed_count/2)) + for ((i=0; i