removed unused imports

This commit is contained in:
Acvaxoort 2023-12-27 17:54:01 +01:00
parent 0444d97d13
commit d6ae1b03b1
3 changed files with 1 additions and 1287 deletions

1282
day24/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
ndarray = "0.15.6"
ndarray-linalg = { version = "0.16", features = ["intel-mkl-static"] }
num = "0.4.1" num = "0.4.1"

View File

@ -1,4 +1,3 @@
use num::ToPrimitive;
use std::fs::read_to_string; use std::fs::read_to_string;
use std::time::Instant; use std::time::Instant;
@ -159,8 +158,7 @@ fn main() {
let l2p1 = (h2.pos.0 as f64, h2.pos.1 as f64); let l2p1 = (h2.pos.0 as f64, h2.pos.1 as f64);
let l2p2 = ((h2.pos.0 + h2.vel.0) as f64, (h2.pos.1 + h2.vel.1) as f64); let l2p2 = ((h2.pos.0 + h2.vel.0) as f64, (h2.pos.1 + h2.vel.1) as f64);
match xy_intersection(l1p1, l1p2, l2p1, l2p2) { match xy_intersection(l1p1, l1p2, l2p1, l2p2) {
LineIntersection::Intersects((xr, yr)) => { LineIntersection::Intersects((x, y)) => {
let (x, y) = (xr.to_f64().unwrap(), yr.to_f64().unwrap());
// Check if it's not in the past, thankfully velocity components are never 0 // Check if it's not in the past, thankfully velocity components are never 0
if (x - h1.pos.0 as f64) / h1.vel.0 as f64 >= 0. if (x - h1.pos.0 as f64) / h1.vel.0 as f64 >= 0.
&& (x - h2.pos.0 as f64) / h2.vel.0 as f64 >= 0. { && (x - h2.pos.0 as f64) / h2.vel.0 as f64 >= 0. {