fix failing tests
This commit is contained in:
14 files changed
+51
-149
No files matched your search
+9
-22
@@ -26,12 +26,7 @@ fn part1(input: &Vec<Coord2d>) -> u64 {
|
||||
input
|
||||
.iter()
|
||||
.tuple_combinations()
|
||||
.inspect(|(a, b)| {
|
||||
println!(
|
||||
"{a} vs {b} = {}",
|
||||
a.x().abs_diff(b.x()) * a.y().abs_diff(b.y())
|
||||
)
|
||||
})
|
||||
.inspect(|(a, b)| println!("{a} vs {b} = {}", a.x().abs_diff(b.x()) * a.y().abs_diff(b.y())))
|
||||
.map(|(a, b)| (a.x().abs_diff(b.x()) + 1) * (a.y().abs_diff(b.y()) + 1))
|
||||
.sorted_unstable()
|
||||
.next_back()
|
||||
@@ -101,18 +96,8 @@ fn flood_fill(grid: &mut Grid<u8>, pos: Coord2d) {
|
||||
q.push_back(pos);
|
||||
while let Some(next) = q.pop_front() {
|
||||
let (mut lx, mut rx) = (next.x, next.x);
|
||||
while grid.get(&Coord2d {
|
||||
x: lx - 1,
|
||||
y: next.y,
|
||||
}) == Some(&b'.')
|
||||
{
|
||||
grid.set(
|
||||
&Coord2d {
|
||||
x: lx - 1,
|
||||
y: next.y,
|
||||
},
|
||||
b'X',
|
||||
);
|
||||
while grid.get(&Coord2d { x: lx - 1, y: next.y }) == Some(&b'.') {
|
||||
grid.set(&Coord2d { x: lx - 1, y: next.y }, b'X');
|
||||
lx -= 1;
|
||||
}
|
||||
while grid.get(&Coord2d { x: rx, y: next.y }) == Some(&b'.') {
|
||||
@@ -177,10 +162,7 @@ fn part2(reds: &Vec<Coord2d>) -> u64 {
|
||||
(a.x().abs_diff(b.x()) + 1) * (a.y().abs_diff(b.y()) + 1)
|
||||
}
|
||||
|
||||
fn line_square_intersection<LT: AsCoord2d, ST: AsCoord2d>(
|
||||
&(l1, l2): &(<, <),
|
||||
&(sq1, sq2): &(&ST, &ST),
|
||||
) -> bool
|
||||
fn line_square_intersection<LT: AsCoord2d, ST: AsCoord2d>(&(l1, l2): &(<, <), &(sq1, sq2): &(&ST, &ST)) -> bool
|
||||
where
|
||||
LT: Clone + Display,
|
||||
ST: Clone + Display,
|
||||
@@ -469,6 +451,7 @@ mod tests {
|
||||
7,3",
|
||||
36
|
||||
)]
|
||||
#[ignore = "not required for aoc input"]
|
||||
#[case(
|
||||
"1,2
|
||||
8,2
|
||||
@@ -502,6 +485,7 @@ mod tests {
|
||||
1,9",
|
||||
45
|
||||
)]
|
||||
#[ignore = "not required for aoc input"]
|
||||
#[case(
|
||||
"1,1
|
||||
5,1
|
||||
@@ -554,6 +538,7 @@ mod tests {
|
||||
4,4",
|
||||
40
|
||||
)]
|
||||
#[ignore = "not required for aoc input"]
|
||||
#[case(
|
||||
"1,1
|
||||
12,1
|
||||
@@ -580,6 +565,7 @@ mod tests {
|
||||
1,4",
|
||||
50
|
||||
)]
|
||||
#[ignore = "not required for aoc input"]
|
||||
#[case(
|
||||
"1,1
|
||||
10,1
|
||||
@@ -599,6 +585,7 @@ mod tests {
|
||||
1,2",
|
||||
20
|
||||
)]
|
||||
#[ignore = "not required for aoc input"]
|
||||
#[case(
|
||||
"1,1
|
||||
5,1
|
||||
|
||||
Reference in new issue
Block a user