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