-fn main() -> io::Result {
+use z3_treefoil::*;
+
+fn main() -> io::Result<()> {
let mut o = io::stdout().lock();
for shape in read_vertices() {
for vx in shape {
for c in vx {
write!(o, "{}", c)?;
}
- write!(o, ",", c)?;
+ write!(o, ",")?;
}
write!(o, "\n")?;
}
+
+ Ok(())
}
//
pub use std::io;
+pub use std::io::Write as _;
pub fn default<T: Default>() -> T { Default::default() }
pub type Coord = i8;
pub type Point = [Coord; DIM];
-pub fn read_vertices() -> impl Iterator<Itme=Vec<Point>> {
+pub fn read_vertices() -> impl Iterator<Item=Vec<Point>> {
io::stdin().lines().map(|l| {
let l = l.unwrap();
- let mut current = default();
+ let mut current: Point = default();
l.chars().map(|cx| {
let cl = cx.to_ascii_lowercase();
- let d = if cx == cl { -1 } else { +1 };
- let i = cl as i8 - 'x';
+ let d = if cx == cl { -1 } else { 1 };
+ let i = cl as usize - 'x' as usize;
current[i] += d;
current
}).collect()
- }
+ })
}