3 filename="${1:-input.txt}"
12 while read -a things -u 3; do
15 ((depth-=${things[1]}))
19 ((depth+=${things[1]}))
23 ((horizontal+=${things[1]}))
24 depth_calc=$((things[1]*aim))
25 ((aim_depth+=$depth_calc))
26 ((aim_horizontal+=${things[1]}))
31 echo "horz * depth = $((depth*$horizontal))"
32 echo "aimed version = $((aim_depth*$aim_horizontal))"