// https://adventofcode.com/2024/day/4 // // Run command: cargo run ./input.txt use std::env; use std::error::Error; use std::fs::File; mod crossword; use crate::crossword::Crossword; fn main() -> Result<(), Box> { // Handle command input let args: Vec = 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); println!("n: {}", crossword.n(3,3).take(4)); println!("ne: {}", crossword.ne(3,3).take(4)); println!("e: {}", crossword.e(3,3).take(4)); println!("se: {}", crossword.se(3,3).take(4)); println!("s: {}", crossword.s(3,3).take(4)); println!("sw: {}", crossword.sw(3,3).take(4)); println!("w: {}", crossword.w(3,3).take(4)); println!("nw: {}", crossword.nw(3,3).take(4)); Ok(()) }