Skip to content

Instantly share code, notes, and snippets.

@pftbest
Created February 1, 2017 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pftbest/5c18e458cddd6a055878503c08a38848 to your computer and use it in GitHub Desktop.
Save pftbest/5c18e458cddd6a055878503c08a38848 to your computer and use it in GitHub Desktop.
#[allow(unused_parens)]
fn main() {
let mut left_edge;
let mut right_edge;
let mut top_edge;
let mut bottom_edge;
let mut max_iter;
let mut x_step;
let mut y_step;
let mut y0;
let mut x0;
let mut x;
let mut y;
let mut i;
let mut x_x;
let mut y_y;
let mut temp;
let mut the_char;
let mut accum;
let mut count;
accum = 0;
count = 0;
while (count < 1545) {
left_edge = -420;
right_edge = 300;
top_edge = 300;
bottom_edge = -300;
x_step = 7;
y_step = 15;
max_iter = 200;
y0 = top_edge;
while (y0 > bottom_edge) {
x0 = left_edge;
while (x0 < right_edge) {
y = 0;
x = 0;
the_char = 32;
x_x = 0;
y_y = 0;
i = 0;
while (i < max_iter && x_x + y_y <= 800) {
x_x = (x * x) / 200;
y_y = (y * y) / 200;
if (x_x + y_y > 800) {
the_char = 48 + i;
if (i > 9) {
the_char = 64;
}
} else {
temp = x_x - y_y + x0;
if ((x < 0 && y > 0) || (x > 0 && y < 0)) {
y = (-1 * ((-1 * (x * y)) / 100)) + y0;
} else {
y = x * y / 100 + y0;
}
x = temp;
}
i = i + 1;
}
accum = accum + the_char;
x0 = x0 + x_step;
}
y0 = y0 - y_step;
}
if (count % 300 == 0) {
println!("{}", accum);
}
count = count + 1;
}
println!("{}", accum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment