From f6e91fa1faa4975ad89a8c91bbe360f22914201e Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 15 Dec 2024 22:45:25 +0800 Subject: [PATCH] Clean up --- 2024/day-15/solution-2.sh | 40 --------------------------------------- 1 file changed, 40 deletions(-) diff --git a/2024/day-15/solution-2.sh b/2024/day-15/solution-2.sh index 0dfc5a6..e16f527 100644 --- a/2024/day-15/solution-2.sh +++ b/2024/day-15/solution-2.sh @@ -4,7 +4,6 @@ FUNCNEST=99999 MAP_FILE=input-map DIRECTIONS_FILE=input-movements MAP_WIDTH=$(( ( $( head -1 "$MAP_FILE" | wc -c ) -1 ) * 2 )) -MAP_HEIGHT=$( < "$MAP_FILE" wc -l ) # Move the robot move_robot() { @@ -132,15 +131,6 @@ horizontal_move_box () { } # Load map -read -r -a TEST_ARRAY <<< "$( - < "$MAP_FILE" paste -s -d "" | - sed -E ' - s/#/##/g; - s/\./../g; - s/@/@./g; - s/O/[]/g; - s/(.)(.)/\1 \2 /g' -)" read -r -a MAP_ARRAY <<< "$( < "$MAP_FILE" paste -s -d "" | sed -E ' @@ -158,17 +148,6 @@ print_map () { printf "\n" } -# Count boxes -#BOX_COUNT=0 -#for (( i=0; i X_L ? X_L : X_R )) - #Y=$(( Y_T > Y_B ? Y_B : Y_T )) X=$(( i % MAP_WIDTH )) Y=$(( i / MAP_WIDTH * 100 )) GPS=$(( X + Y )) #printf "Box %s X: %s Y: %s GPS: %s\n" "$i" "$X" "$Y" "$GPS" - #if [[ $GPS -lt 0 ]] ; then printf "Negative GPS: %s for box %s\n" "$GPS" "$i"; continue; fi (( SUM+=GPS )) fi done printf "Sum: %s\n" "$SUM" printf "Box count: %s\n" "$BOX_COUNT" - -# Compare and test if walls have moved -for (( i=0; i