Change max and min
continuous-integration/drone/push Build is passing Details

main
Julius 2021-12-17 14:35:16 +01:00
parent ad781231e9
commit a844f19446
Signed by: j00lz
GPG Key ID: AF241B0AA237BBA2
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,8 @@ pub struct Day17 {
y_max: i32,
}
const Y_MAX: i32 = 100;
impl Day for Day17 {
fn init(content: String) -> anyhow::Result<Self> {
let c = content.split(' ').skip(1).collect::<Vec<_>>();
@ -23,9 +25,10 @@ impl Day for Day17 {
}
fn part1(&self) -> anyhow::Result<String> {
println!("{}", self.y_max - self.y_min);
let mut hits = Vec::new();
for dx in 0..=self.x_max {
for dy in -100..250 {
for dy in self.y_min..Y_MAX {
let points = self.calc((dx, dy));
if self.hits(&points) {
hits.push(max_height(&points).unwrap());
@ -38,7 +41,7 @@ impl Day for Day17 {
fn part2(&self) -> anyhow::Result<String> {
let mut hits = Vec::new();
for dx in 0..=self.x_max {
for dy in -100..250 {
for dy in self.y_min..Y_MAX {
let points = self.calc((dx, dy));
if self.hits(&points) {
hits.push((dx, dy));