2025-05-27 22:33:40 -05:00
|
|
|
// https://adventofcode.com/2024/day/4
|
2025-05-27 22:10:38 -05:00
|
|
|
//
|
|
|
|
|
// Run command: cargo run ./input.txt
|
|
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
use std::error::Error;
|
|
|
|
|
use std::fs::File;
|
|
|
|
|
|
2025-05-27 22:26:05 -05:00
|
|
|
mod crossword;
|
2025-05-27 22:10:38 -05:00
|
|
|
|
2025-05-27 22:26:05 -05:00
|
|
|
use crate::crossword::Crossword;
|
2025-05-27 22:10:38 -05:00
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
|
// Handle command input
|
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
|
if args.len() != 2 {
|
|
|
|
|
panic!(
|
|
|
|
|
"{} must be run with a single argument of files name!",
|
|
|
|
|
&args[0]
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
let input_file_string = &args[1];
|
|
|
|
|
|
|
|
|
|
let crossword = Crossword::new(File::open(input_file_string)?)?;
|
|
|
|
|
|
|
|
|
|
println!("{}", crossword);
|
|
|
|
|
|
|
|
|
|
Ok(())
|
2025-05-26 15:47:33 -05:00
|
|
|
}
|