Compare commits
2 Commits
267816b70e
...
cb41e4db56
| Author | SHA1 | Date | |
|---|---|---|---|
| cb41e4db56 | |||
| f273c1719c |
10
src/day14.rs
10
src/day14.rs
@@ -10,8 +10,8 @@ use itertools::Itertools;
|
|||||||
pub fn day_main() {
|
pub fn day_main() {
|
||||||
let input = read_to_string("input/day14.txt").unwrap();
|
let input = read_to_string("input/day14.txt").unwrap();
|
||||||
let input = input.trim();
|
let input = input.trim();
|
||||||
println!(" part1: {}", part1(input)); // 50112000 too low
|
println!(" part1: {}", part1(input));
|
||||||
println!(" part2: {}", part2(input));
|
// println!(" part2: {}", part2(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
type RiddleResult = usize;
|
type RiddleResult = usize;
|
||||||
@@ -45,7 +45,6 @@ fn solve_part1(input: &str, rounds: i64, width: i64, height: i64) -> RiddleResul
|
|||||||
.filter(|&&((px, py), _)| px > width / 2 && py > height / 2)
|
.filter(|&&((px, py), _)| px > width / 2 && py > height / 2)
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
if upper_left + lower_left == upper_right + lower_right {}
|
|
||||||
upper_left * lower_left * upper_right * lower_right
|
upper_left * lower_left * upper_right * lower_right
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +67,7 @@ fn parse(input: &str) -> Vec<((i64, i64), (i64, i64))> {
|
|||||||
.collect_vec()
|
.collect_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
fn part2(input: &str) -> RiddleResult {
|
fn part2(input: &str) -> RiddleResult {
|
||||||
let width = 101;
|
let width = 101;
|
||||||
let height = 103;
|
let height = 103;
|
||||||
@@ -105,7 +105,9 @@ fn part2(input: &str) -> RiddleResult {
|
|||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn printr(robots: &[((i64, i64), (i64, i64))], width: i64, height: i64) {
|
type Robot = ((i64, i64), (i64, i64));
|
||||||
|
|
||||||
|
fn printr(robots: &[Robot], width: i64, height: i64) {
|
||||||
for y in 0..height {
|
for y in 0..height {
|
||||||
for x in 0..width {
|
for x in 0..width {
|
||||||
let c = robots
|
let c = robots
|
||||||
|
|||||||
Reference in New Issue
Block a user