use std::env; fn escapes(cr: f64, ci: f64, it: u32) -> char { let mut zr = 0.0 as f64; let mut zi = 0.0 as f64; let mut zrtmp: f64; for _i in 0..it { zrtmp = zr*zr - zi*zi + cr; zi = 2.0*zr*zi + ci; zr = zrtmp; if zr*zr + zi*zi > 4.0 { return ' '; } } return 'X'; } fn main() { let xmin = -2.0 as f64; let xmax = 1.0 as f64; let ymin = -1.0 as f64; let ymax = 1.0 as f64; let args: Vec = env::args().collect(); let xstep = args[1].parse::().unwrap(); let ystep = args[2].parse::().unwrap(); let iters = args[3].parse::().unwrap(); let mut x: f64; let mut y: f64; for yc in 0..ystep { y = (yc as f64) * (ymax - ymin) / (ystep as f64) + ymin; for xc in 0..xstep { x = (xc as f64) * (xmax - xmin) / (xstep as f64) + xmin; print!("{}", escapes(x, y, iters)); } println!(); } }