percentage perfect
This commit is contained in:
parent
107d585b19
commit
931a7d73ad
2 changed files with 11 additions and 4 deletions
|
@ -392,7 +392,7 @@ impl BoardState {
|
||||||
|
|
||||||
// best possible value we can get for firework of that color,
|
// best possible value we can get for firework of that color,
|
||||||
// based on looking at discard + fireworks
|
// 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();
|
let firework = self.fireworks.get(color).unwrap();
|
||||||
if firework.complete() {
|
if firework.complete() {
|
||||||
return FINAL_VALUE;
|
return FINAL_VALUE;
|
||||||
|
|
|
@ -159,14 +159,21 @@ pub fn simulate<T>(
|
||||||
let mut histogram = Histogram::new();
|
let mut histogram = Histogram::new();
|
||||||
for join_handle in join_handles {
|
for join_handle in join_handles {
|
||||||
let (thread_non_perfect_seeds, thread_histogram) = join_handle.join();
|
let (thread_non_perfect_seeds, thread_histogram) = join_handle.join();
|
||||||
info!("Thread joined");
|
|
||||||
non_perfect_seeds.extend(thread_non_perfect_seeds.iter());
|
non_perfect_seeds.extend(thread_non_perfect_seeds.iter());
|
||||||
histogram.merge(thread_histogram);
|
histogram.merge(thread_histogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
non_perfect_seeds.sort();
|
|
||||||
info!("Seeds with non-perfect score: {:?}", non_perfect_seeds);
|
|
||||||
info!("Score histogram:\n{}", histogram);
|
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();
|
let average = histogram.average();
|
||||||
info!("Average score: {:?}", average);
|
info!("Average score: {:?}", average);
|
||||||
average
|
average
|
||||||
|
|
Loading…
Reference in a new issue