From 9492a8ae9a77211cd0035a1a4ed68f2599b1ec76 Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 15 Dec 2024 00:38:13 +0800 Subject: [PATCH] Terrible solution to a terrible question. Working part 2 --- 2024/day-14/solution-2.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/2024/day-14/solution-2.sh b/2024/day-14/solution-2.sh index 4b09b05..4685b03 100644 --- a/2024/day-14/solution-2.sh +++ b/2024/day-14/solution-2.sh @@ -22,8 +22,11 @@ read -r -a BOT_ARRAY <<< "$( grep -Eo '[-0-9]*' "$FILE" | paste -s -d " " )" printf "Bot array size: %s\n" "${#BOT_ARRAY[@]}" # Load arrangements for every second -for SECONDS in $( seq 1 100 ) +#for SECONDS in $( seq 1 9999 ) +for SECONDS in $( seq 6514 6516 ) do + # Compute positions for each bot + printf "Working on +%s seconds.\n" "$SECONDS" IFS=';'; read -r -a FINAL_ARRAY <<< "$( for (( i=0; i<${#BOT_ARRAY[@]}; i+=4 )) do @@ -39,6 +42,7 @@ do unset IFS # Generate "empty" map + # Map is a 1d array MAP_LEN=$(( MAP_HEIGHT * MAP_WIDTH )) read -r -a MAP_ARRAY <<< "$( for (( i=0; i