From b059ea0302d44f72278e77074b9ec58ff4b69d15 Mon Sep 17 00:00:00 2001 From: Pierre Jeanjean Date: Sat, 25 Dec 2021 11:18:28 +0100 Subject: [PATCH] Day 25 --- 25/01.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 25/01.sh diff --git a/25/01.sh b/25/01.sh new file mode 100755 index 0000000..fc1b661 --- /dev/null +++ b/25/01.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +max_i=0 +max_j=0 +declare -A grid +while read line; do + max_j=${#line} + for ((j=0;j' ]]; then + grid[$max_i,$j]=1 + elif [[ ${line:$j:1} == 'v' ]]; then + grid[$max_i,$j]=2 + fi + done + max_i=$((max_i+1)) +done + +changes=1 +south=0 +steps=0 +while [ $changes -eq 1 ]; do + changes=$south + declare -A new_grid + for ((i=0;i