()
| 1 | use graplot::{Desc, Plot, PlotArg}; |
| 2 | |
| 3 | fn main() { |
| 4 | let mut plot = Plot::default(); |
| 5 | plot.set_title("Collatz Conjecture"); |
| 6 | plot.set_desc(Desc { |
| 7 | min_steps_x: 10., |
| 8 | spacing_x: 47., |
| 9 | ..Default::default() |
| 10 | }); |
| 11 | |
| 12 | for input in 1000..=1001 { |
| 13 | let mut single_graph = collatz(input as f64).as_plot(); |
| 14 | single_graph.set_color(0., 1. * (input == 1000) as i32 as f32, 1.); |
| 15 | plot.add(single_graph); |
| 16 | } |
| 17 | plot.show(); |
| 18 | } |
| 19 | |
| 20 | fn collatz(input: f64) -> Vec<f64> { |
| 21 | let mut list: Vec<f64> = Vec::new(); |