mirror of
https://github.com/bdnugget/aoc_bash.git
synced 2026-11-07 04:37:27 +00:00
d1p1
This commit is contained in:
1 parent
0520ad7c56
commit
abbc7347a2
2 files changed
+4074
-4
No files matched your search
+4068
File diff suppressed because it is too large.
Load diff
+6
-4
@@ -15,9 +15,9 @@ main() {
|
||||
|
||||
# apply rotation
|
||||
if [[ "$dir" == L ]]; then
|
||||
dial=$(( dial - num ))
|
||||
dial=$(( dial - num ))
|
||||
else
|
||||
dial=$(( dial + num ))
|
||||
dial=$(( dial + num ))
|
||||
fi
|
||||
|
||||
# wrap into 0–99
|
||||
@@ -25,9 +25,11 @@ main() {
|
||||
|
||||
# count zero hits
|
||||
if (( dial == 0 )); then
|
||||
((count++))
|
||||
((count+=1))
|
||||
fi
|
||||
done < example.txt
|
||||
|
||||
#done < example.txt
|
||||
done < input.txt
|
||||
|
||||
printf "%d\n" "$count"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user