Day 19 part 2: some bash cleanup

This commit is contained in:
2021-07-21 17:45:33 +02:00
parent 97cd8bf884
commit 8bc0e74e10

View File

@@ -69,20 +69,20 @@ done
# hack:
# 1) build part 1 tree
# 1) build rules 42 and 31
# 2) calculate rule 8 and 11 with some "guessed" minimum possible value
# 3) rebuild tree from scratch, but with rules 8 and 11 pre-loaded
buildtree 1 var_0 0
# 3) build rule 0
# This value was found manually: stable from 5.
# result starts to be "stable" from this value
SOME_LIMIT=5
buildtree 1 var_0 42
buildtree 1 var_0 31
tmp8="(${MATCH[42]})+"
tmp11="(${MATCH[42]}${MATCH[31]})"
for ((i=2; i<SOME_LIMIT; ++i)); do
tmp11+="|((${MATCH[42]}){$i}(${MATCH[31]}){$i})"
done
MATCH=()
MATCH[8]="$tmp8"
MATCH[11]="($tmp11)"
buildtree 1 var_0 0
@@ -93,5 +93,3 @@ for str in "${STRING[@]}"; do
done
printf "%s : res=%d\n" "$CMD" "$res"
exit 0