-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
145 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ pub use play::*; | |
pub mod analyze; | ||
pub mod counter; | ||
pub mod search; | ||
pub mod stats; | ||
|
||
mod trans_table; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
pub trait Stats { | ||
fn guess_iter(&mut self); | ||
fn max_tricks_cutoff(&mut self); | ||
fn node_visit(&mut self); | ||
fn quick_tricks_cutoff(&mut self); | ||
fn search_cutoff(&mut self); | ||
fn search_finished(&mut self); | ||
fn search_started(&mut self); | ||
fn tt_hit(&mut self); | ||
fn tt_lower_cutoff(&mut self); | ||
fn tt_upper_cutoff(&mut self); | ||
} | ||
|
||
pub struct EmptyStats {} | ||
|
||
impl Stats for EmptyStats { | ||
fn node_visit(&mut self) {} | ||
|
||
fn tt_lower_cutoff(&mut self) {} | ||
|
||
fn tt_upper_cutoff(&mut self) {} | ||
|
||
fn guess_iter(&mut self) {} | ||
|
||
fn max_tricks_cutoff(&mut self) {} | ||
|
||
fn quick_tricks_cutoff(&mut self) {} | ||
|
||
fn search_cutoff(&mut self) {} | ||
|
||
fn search_finished(&mut self) {} | ||
|
||
fn search_started(&mut self) {} | ||
|
||
fn tt_hit(&mut self) {} | ||
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct UnsyncStats { | ||
guess_iter: usize, | ||
max_tricks_cutoff: usize, | ||
nodes: usize, | ||
quick_tricks_cutoff: usize, | ||
search_cutoff: usize, | ||
search: usize, | ||
tt_hit: usize, | ||
tt_lower_cutoff: usize, | ||
tt_upper_cutoff: usize, | ||
} | ||
|
||
impl Stats for UnsyncStats { | ||
fn node_visit(&mut self) { | ||
self.nodes += 1; | ||
} | ||
|
||
fn tt_lower_cutoff(&mut self) { | ||
self.tt_lower_cutoff += 1; | ||
} | ||
|
||
fn tt_upper_cutoff(&mut self) { | ||
self.tt_upper_cutoff += 1; | ||
} | ||
|
||
fn guess_iter(&mut self) { | ||
self.guess_iter += 1; | ||
} | ||
|
||
fn max_tricks_cutoff(&mut self) { | ||
self.max_tricks_cutoff += 1; | ||
} | ||
|
||
fn quick_tricks_cutoff(&mut self) { | ||
self.quick_tricks_cutoff += 1; | ||
} | ||
|
||
fn search_cutoff(&mut self) { | ||
self.search_cutoff += 1; | ||
} | ||
|
||
fn search_finished(&mut self) { | ||
println!("{self:?}"); | ||
} | ||
|
||
fn search_started(&mut self) { | ||
self.search += 1; | ||
} | ||
|
||
fn tt_hit(&mut self) { | ||
self.tt_hit += 1; | ||
} | ||
} |