diff --git a/Cargo.lock b/Cargo.lock index 7a512e5..c7d66be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,14 +29,6 @@ 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" @@ -75,6 +67,7 @@ dependencies = [ "atoi", "bitflags", "cached", + "colored", "grid", "itertools", "rayon", @@ -149,6 +142,16 @@ 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" @@ -266,6 +269,12 @@ 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" @@ -538,6 +547,72 @@ 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" diff --git a/Cargo.toml b/Cargo.toml index 7f7d80d..de0ae59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ 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" @@ -18,7 +19,3 @@ thread_local = "1.1.8" [profile.release] lto = true - -[workspace] -members = [ ".", "utils/grid", "target/aoc/aoc-autobuild" ] -default-members = [ ".", "utils/*" ] \ No newline at end of file diff --git a/src/day14.rs b/src/day14.rs index 3e8ac93..f272b0b 100644 --- a/src/day14.rs +++ b/src/day14.rs @@ -1,4 +1,5 @@ use aoc_runner_derive::aoc; +use colored::Colorize; use grid::{AsCoord2d, Coord2d, Grid}; use regex::Regex; use std::str::FromStr; @@ -77,13 +78,13 @@ fn display(robots: &Vec, bounds: (i64, i64)) { print!( "{}", if *grid.get(&(col, row)).unwrap() != 0 { - "█" + "█".green() } else { - " " + " ".color(colored::Color::Black) } ); } - println!(" EOL"); + println!(); } } @@ -136,6 +137,7 @@ 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; } }