day 9 part 1 solution
This commit is contained in:
@ -40,6 +40,7 @@ do
|
||||
while true
|
||||
do
|
||||
HEAD=$(( A - DIFF * HEADC ))
|
||||
if [[ ${SHADOW_ARRAY[HEAD]} == "X" ]]; then (( HEADC++ )); continue ; fi
|
||||
HEADVDIFF=$(( (A / LEN) - (HEAD / LEN) ))
|
||||
# Check if out of bounds
|
||||
if [[ $HEAD -lt ${#MAP_ARRAY[@]} ]] && \
|
||||
@ -57,6 +58,7 @@ do
|
||||
while true
|
||||
do
|
||||
TAIL=$(( B + DIFF * TAILC ))
|
||||
if [[ ${SHADOW_ARRAY[TAIL]} == "X" ]]; then (( TAILC++ )); continue ; fi
|
||||
TAILVDIFF=$(( (TAIL / LEN) - (B / LEN) ))
|
||||
# Check if out of bounds
|
||||
if [[ $TAIL -lt ${#MAP_ARRAY[@]} ]] && \
|
||||
@ -75,6 +77,6 @@ do
|
||||
unset IDX_ARRAY
|
||||
|
||||
done
|
||||
printf "%s" "${SHADOW_ARRAY[@]}" | fold -w "$LEN" | sed -E 's/(.)/\1\ /g'
|
||||
printf "\n"
|
||||
#printf "%s" "${SHADOW_ARRAY[@]}" | fold -w "$LEN" | sed -E 's/(.)/\1\ /g'
|
||||
#printf "\n"
|
||||
printf "%s" "${SHADOW_ARRAY[@]}" | grep -o 'X' | wc -l
|
||||
|
Reference in New Issue
Block a user