This commit is contained in:
parent
ad781231e9
commit
a844f19446
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue