Skip to content

Commit

Permalink
fix arc::into_inner failure
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperCodec committed May 15, 2024
1 parent 4b8cef0 commit 6a7090a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target/
/.vscode/
best-agent.json
best-agent.json
fitness-plot.svg
5 changes: 4 additions & 1 deletion examples/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct PerformanceStats {
low: f32,
}

const OUTPUT_FILE_NAME: &'static str = "fitness-plot.png";
const OUTPUT_FILE_NAME: &'static str = "fitness-plot.svg";
const GENS: usize = 100;
fn main() -> Result<(), Box<dyn Error>> {
let mut rng = rand::thread_rng();
Expand All @@ -86,6 +86,9 @@ fn main() -> Result<(), Box<dyn Error>> {
sim.next_generation();
}

// prevent `Arc::into_inner` from failing
drop(sim);

println!("Training complete, collecting data and building chart...");

let root = SVGBackend::new(OUTPUT_FILE_NAME, (640, 480)).into_drawing_area();
Expand Down

0 comments on commit 6a7090a

Please sign in to comment.