aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2021/05/puzzles.awk8
1 files changed, 4 insertions, 4 deletions
diff --git a/2021/05/puzzles.awk b/2021/05/puzzles.awk
index 5710a92..f735249 100644
--- a/2021/05/puzzles.awk
+++ b/2021/05/puzzles.awk
@@ -8,10 +8,10 @@ $2 == $4 && $1 <= $3 { while ($1 <= $3) grid[$2][$1++]++; next }
$2 == $4 { while ($3 <= $1) grid[$2][$3++]++; next }
# START PART 2
-$1 <= $3 && $2 <= $4 { while (!($1 > $3)) grid[$2++][$1++]++; next }
-$1 <= $3 { while (!($1 > $3)) grid[$2--][$1++]++; next }
-$2 <= $4 { while (!($1 < $3)) grid[$2++][$1--]++; next }
- { while (!($1 < $3)) grid[$2--][$1--]++; next }
+$1 <= $3 && $2 <= $4 { while ($1 <= $3) grid[$2++][$1++]++; next }
+$1 <= $3 { while ($1 <= $3) grid[$2--][$1++]++; next }
+$2 <= $4 { while ($1 >= $3) grid[$2++][$1--]++; next }
+ { while ($1 >= $3) grid[$2--][$1--]++; next }
# END PART 2
END {