1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
pub fn bool_2dvec_to_string(arr: Vec<Vec<bool>>) -> String { let mut result = String::new(); for y in 0..arr.len() / 2 { for x in 0..arr[0].len() { let upper = arr[y*2][x]; let lower = arr[y*2+1][x]; match upper { true => { match lower { true => result.push_str("█"), false => result.push_str("▀") } }, false => { match lower { true => result.push_str("▄"), false => result.push_str(" ") } } } }; result.push_str("\n") }; result } pub fn display(arr: Vec<Vec<bool>>) { print!("{}", bool_2dvec_to_string(arr)) }