From: Brett Parker Date: Wed, 9 Dec 2020 01:40:12 +0000 (+0000) Subject: ZAP! Day 10. X-Git-Url: https://git.sommitrealweird.co.uk/advent-of-code-2019.git/commitdiff_plain/e89a78b0539f89e5276ce18ba0c88ee87863a778?ds=inline;hp=8559cc01c88addff1e3970519775d08c121ce5bf ZAP! Day 10. --- diff --git a/day10/common.sh b/day10/common.sh index 86979ed..db5c6b9 100644 --- a/day10/common.sh +++ b/day10/common.sh @@ -4,8 +4,8 @@ get_vector() { local x2=$3 local y2=$4 - x_diff=$(($x1 - $x2)) - y_diff=$(($y1 - $y2)) + x_diff=$(($x2 - $x1)) + y_diff=$(($y2 - $y1)) echo "$x_diff,$y_diff" } diff --git a/day10/zap.sh b/day10/zap.sh new file mode 100644 index 0000000..eae98d2 --- /dev/null +++ b/day10/zap.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +basedir=$(dirname $(readlink -f $BASH_SOURCE)) +. $basedir/common.sh + +our_asteroid=26,29 + +declare -A asteroids +declare -A asteroid_angles + +exec 3