From 95e4a6f8cc7c53a926d4e755ecb3bd19fb1486cf Mon Sep 17 00:00:00 2001 From: kageru Date: Fri, 17 Dec 2021 21:52:42 +0100 Subject: [PATCH] Day 17: no longer hardcode upper search bounds --- 2021/src/bin/day17.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2021/src/bin/day17.rs b/2021/src/bin/day17.rs index d42ac1e..af12bce 100644 --- a/2021/src/bin/day17.rs +++ b/2021/src/bin/day17.rs @@ -40,7 +40,7 @@ fn find_hits(target: &TargetArea) -> Vec { // Doing y in the outer loop and x in the inner would allow us to call last() instead of max() // in part1, however, for reasons unknown to me, that makes this function 20% slower. (1..=*target.0.end()) - .flat_map(move |x| (*target.1.start()..250).map(move |y| (x, y))) + .flat_map(move |x| (*target.1.start()..-target.1.start()).map(move |y| (x, y))) .filter_map(|(startx, starty)| { let mut probe = ((startx, starty), (0, 0)); loop {