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, ",")?;
- }
- write!(o, "\n")?;
+ print_shape(&shape)?;
}
Ok(())
pub const DIM: usize = 3;
pub type Coord = i8;
pub type Point = [Coord; DIM];
+pub type Shape = Vec<Point>;
-pub fn read_vertices() -> impl Iterator<Item=Vec<Point>> {
+pub fn read_vertices() -> impl Iterator<Item=Shape> {
io::stdin().lines().map(|l| {
let l = l.unwrap();
let mut current: Point = default();
}).collect()
})
}
+
+pub fn print_shape(shape: &Shape) -> io::Result<()> {
+ let mut o = io::stdout().lock();
+ for vx in shape {
+ for c in vx {
+ write!(o, "{}", c)?;
+ }
+ write!(o, ",")?;
+ }
+ write!(o, "\n")?;
+ Ok(())
+}