percentage perfect

This commit is contained in:
Jeff Wu 2016-03-19 15:26:41 -07:00
parent 107d585b19
commit 931a7d73ad
2 changed files with 11 additions and 4 deletions

View File

@ -392,7 +392,7 @@ impl BoardState {
// best possible value we can get for firework of that color,
// based on looking at discard + fireworks
pub fn highest_attainable(&self, color: &Color) -> Value {
fn highest_attainable(&self, color: &Color) -> Value {
let firework = self.fireworks.get(color).unwrap();
if firework.complete() {
return FINAL_VALUE;

View File

@ -159,14 +159,21 @@ pub fn simulate<T>(
let mut histogram = Histogram::new();
for join_handle in join_handles {
let (thread_non_perfect_seeds, thread_histogram) = join_handle.join();
info!("Thread joined");
non_perfect_seeds.extend(thread_non_perfect_seeds.iter());
histogram.merge(thread_histogram);
}
non_perfect_seeds.sort();
info!("Seeds with non-perfect score: {:?}", non_perfect_seeds);
info!("Score histogram:\n{}", histogram);
non_perfect_seeds.sort();
// info!("Seeds with non-perfect score: {:?}", non_perfect_seeds);
if non_perfect_seeds.len() > 0 {
info!("Example seed with non-perfect score: {}",
non_perfect_seeds.get(0).unwrap().1);
}
let percentage = (n_trials - non_perfect_seeds.len() as u32) as f32 / n_trials as f32;
info!("Percentage perfect: {:?}%", percentage);
let average = histogram.average();
info!("Average score: {:?}", average);
average