Compare commits

..

No commits in common. "8ae2115b5205c9161ad0db7f719eb976e0b390c1" and "c6153663b5726db7bfb2b877066e6a7d85b787bf" have entirely different histories.

7 changed files with 19 additions and 104 deletions

View File

@ -20,11 +20,6 @@ jobs:
components: clippy, rustfmt
toolchain: stable
- name: fake inputs
run: |
mkdir -p input/2024/
for i in $(seq 1 25); do touch input/2024/day${i}.txt; done
- name: cargo test
run: cargo test --lib --all-features

91
Cargo.lock generated
View File

@ -29,6 +29,14 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "aoc-autobuild"
version = "0.3.0"
dependencies = [
"aoc-runner",
"aoc2024",
]
[[package]]
name = "aoc-runner"
version = "0.3.0"
@ -67,7 +75,6 @@ dependencies = [
"atoi",
"bitflags",
"cached",
"colored",
"grid",
"itertools",
"rayon",
@ -142,16 +149,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "colored"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
"lazy_static",
"windows-sys",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
@ -269,12 +266,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "log"
version = "0.4.22"
@ -547,72 +538,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "zerocopy"
version = "0.7.35"

View File

@ -9,7 +9,6 @@ aoc-runner-derive = "0.3.0"
atoi = "2.0.0"
bitflags = "2.6.0"
cached = "0.54.0"
colored = "2.1.0"
grid = { version = "0.1.0", path = "utils/grid" }
itertools = "0.13.0"
rayon = "1.10.0"
@ -19,3 +18,7 @@ thread_local = "1.1.8"
[profile.release]
lto = true
[workspace]
members = [ ".", "utils/grid", "target/aoc/aoc-autobuild" ]
default-members = [ ".", "utils/*" ]

View File

@ -89,4 +89,4 @@ mod tests {
let input = get_input(EXAMPLE);
assert_eq!(part2(&input), 31);
}
}
}

View File

@ -1,5 +1,4 @@
use aoc_runner_derive::aoc;
use colored::Colorize;
use grid::{AsCoord2d, Coord2d, Grid};
use regex::Regex;
use std::str::FromStr;
@ -78,13 +77,13 @@ fn display(robots: &Vec<Robot>, bounds: (i64, i64)) {
print!(
"{}",
if *grid.get(&(col, row)).unwrap() != 0 {
"".green()
""
} else {
" ".color(colored::Color::Black)
" "
}
);
}
println!();
println!(" EOL");
}
}
@ -137,7 +136,6 @@ pub fn part2(input: &str) -> u64 {
.filter(|c| !c.is_empty() && c[0] != 0)
.any(|c| c.len() > width as usize / 10)
{
display(&robots, (width, height));
return i;
}
}

View File

@ -53,17 +53,11 @@ impl WordSearch {
for x in 0..width {
for y in 0..height {
// check down-right
if x <= width - needle.len()
&& y <= height - needle.len()
&& (0..needle.len()).all(|i| self.get(x + i, y + i) == needle.as_bytes()[i].into())
{
if x <= width - needle.len() && y <= height - needle.len() && (0..needle.len()).all(|i| self.get(x + i, y + i) == needle.as_bytes()[i].into()) {
count += 1
}
// check down-left
if x >= needle.len() - 1
&& y <= height - needle.len()
&& (0..needle.len()).all(|i| self.get(x - i, y + i) == needle.as_bytes()[i].into())
{
if x >= needle.len() - 1 && y <= height - needle.len() && (0..needle.len()).all(|i| self.get(x - i, y + i) == needle.as_bytes()[i].into()) {
count += 1
}
}

View File

@ -1,3 +1,3 @@
use aoc_runner_derive::aoc_main;
aoc_main! { lib = aoc2024 }
aoc_main!{ lib = aoc2024 }