From f6d4be2195a9103e42b00c9aa362c62d079c3f4e Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sat, 22 Oct 2022 13:12:04 +0200 Subject: stats loading directly from json file --- srchr/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'srchr/src/main.rs') diff --git a/srchr/src/main.rs b/srchr/src/main.rs index 667b675..b4a26f9 100644 --- a/srchr/src/main.rs +++ b/srchr/src/main.rs @@ -67,7 +67,7 @@ impl<'a> Tournament<'a> { }); let result; - if tournament[0].1 < best { + if tournament[0].1 + 0.00001 < best { result = Some(tournament[0].0); } else { result = None; @@ -82,7 +82,12 @@ impl<'a> Tournament<'a> { } fn main() { - let corpus = Corpus::load(CORPUS_FILE_NAME).unwrap(); + let corpus; + if LOAD_STATS { + corpus = Corpus::load_from_json_file(STATS_FILE_NAME).unwrap(); + } else { + corpus = Corpus::load_from_text_file(CORPUS_FILE_NAME).unwrap(); + } println!("{}", corpus); let seed_layout = Layout::from_verbose(STARTING_LAYOUT_STRING).unwrap(); -- cgit v1.3.1