Skip to content

Commit

Permalink
fix: move node count to beginning of solver
Browse files Browse the repository at this point in the history
hit on terminal nodes as well
  • Loading branch information
LeoDog896 committed Sep 26, 2024
1 parent e22188b commit 409f765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/game-solver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ fn negamax<T: Game<Player = impl TwoPlayer + 'static> + Eq + Hash>(
}
}

if let Some(stats) = stats {
stats.states_explored.fetch_add(1, Ordering::Relaxed);
}

// TODO: debug-based depth counting
// if let Some(stats) = stats {
// stats.max_depth.fetch_max(depth, Ordering::Relaxed);
Expand Down Expand Up @@ -137,10 +141,6 @@ fn negamax<T: Game<Player = impl TwoPlayer + 'static> + Eq + Hash>(
}
}

if let Some(stats) = stats {
stats.states_explored.fetch_add(1, Ordering::Relaxed);
}

// fetch values from the transposition table
{
let score = transposition_table
Expand Down
4 changes: 0 additions & 4 deletions crates/games/src/util/cli/human.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ impl<G: Game> Widget for &App<G> {
fn render(self, area: Rect, buf: &mut Buffer) {
let title = Title::from(" game-solver ".bold().green());
let instructions = Title::from(Line::from(vec![
" Decrement ".into(),
"<Left>".blue().bold(),
" Increment ".into(),
"<Right>".blue().bold(),
" Quit ".into(),
"<Q> ".blue().bold(),
]));
Expand Down

0 comments on commit 409f765

Please sign in to comment.