From 0223d4bd2c7c94b9e8ebcf74736750a0e23df8f7 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Sun, 25 Jul 2021 16:53:07 +0200 Subject: [PATCH] code cleanup --- 2020/day20/Makefile | 2 +- 2020/day20/ex1.bash | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/2020/day20/Makefile b/2020/day20/Makefile index 62c581b..224acfb 100644 --- a/2020/day20/Makefile +++ b/2020/day20/Makefile @@ -20,7 +20,7 @@ ex1: @#$(TIME) ex1-c 2020 < $(INPUT) 2>&1 ex2: - @#$(TIME) ex2.bash < $(INPUT) 2>&1 + @$(TIME) ex2.bash < $(INPUT) 2>&1 @#$(TIME) ex1-c 30000000 < $(INPUT) 2>&1 clean: diff --git a/2020/day20/ex1.bash b/2020/day20/ex1.bash index ecf642d..5149c56 100755 --- a/2020/day20/ex1.bash +++ b/2020/day20/ex1.bash @@ -6,10 +6,9 @@ CMD=${0##*/} set -o noglob shopt -s extglob -#declare -A strings declare -a strings T R B L RT RR RB RL nums +declare -i res=1 count=-1 -declare -i count=-1 while read -r line; do case ${line:0:1} in T*) @@ -54,10 +53,9 @@ for key in "${!nums[@]}"; do done -ALL="${T[@]} ${R[@]} ${B[@]} ${L[@]} ${RT[@]} ${RR[@]} ${RB[@]} ${RL[@]}" +ALL="${T[*]} ${R[*]} ${B[*]} ${L[*]} ${RT[*]} ${RR[*]} ${RB[*]} ${RL[*]}" ALLSIZE=${#ALL} -declare -i res=1 count for ((i=0; i<${#nums[@]}; ++i)); do count=0