Cleanup
This commit is contained in:
parent
f9d37a028a
commit
8ccbf40783
@ -31,7 +31,6 @@ main ()
|
||||
possible_ids+=($id)
|
||||
fi
|
||||
done < input.txt
|
||||
echo "${possible_ids[@]}"
|
||||
declare -i sum=0
|
||||
for id in "${possible_ids[@]}"; do
|
||||
(( sum+=id ))
|
||||
|
@ -15,7 +15,6 @@ main ()
|
||||
while read -r line; do
|
||||
declare -a winning=() mine=() mywinning=()
|
||||
declare -i card_sum=0
|
||||
echo "$line"
|
||||
stripped=$(sed 's/Card\s\{1,3\}[0-9]\{1,3\}: //' <<< "${line}")
|
||||
winning+=($(cut -d '|' -f 1 <<< "${stripped}"))
|
||||
mine+=($(cut -d '|' -f 2 <<< "${stripped}"))
|
||||
@ -27,7 +26,6 @@ main ()
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo mywwinning ${mywinning[@]}
|
||||
for number in "${mywinning[@]}"; do
|
||||
if [[ card_sum -eq 0 ]]; then
|
||||
card_sum=$((card_sum+1))
|
||||
@ -35,9 +33,7 @@ main ()
|
||||
card_sum=$((card_sum*2))
|
||||
fi
|
||||
done
|
||||
echo "card sum: $card_sum"
|
||||
sum=$((sum+card_sum))
|
||||
echo "sum: ${sum}"
|
||||
done < input.txt
|
||||
echo "${sum}"
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ CARDS="${#INPUT[@]}"
|
||||
|
||||
run_cards ()
|
||||
{
|
||||
# Receives space separated list of cards I have.
|
||||
for ((x=1; x<=CARDS; x++)); do
|
||||
declare -a winning=() mine=()
|
||||
declare -i matching=0
|
||||
@ -45,7 +44,6 @@ main ()
|
||||
done
|
||||
run_cards "${hand[@]}"
|
||||
for ((z=1; z<=CARDS; z++)); do
|
||||
echo "card $z: ${hand[$z]}"
|
||||
sum=$((sum+${hand[$z]}))
|
||||
done
|
||||
echo "${sum}"
|
||||
|
Loading…
Reference in New Issue
Block a user