diff options
| author | Micha White <botahamec@outlook.com> | 2023-09-27 09:35:50 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2023-09-27 09:35:50 -0400 |
| commit | 1b379403ab971e188483df5d580c39695db7f44a (patch) | |
| tree | f9d547fe9d4bf0fd7c8ddabcf5e6fd119a9ff6bf /ai/src/main.rs | |
| parent | 10438fa9ae1dc4624ebb1780238d46d4b5d3f0eb (diff) | |
Big changes
Diffstat (limited to 'ai/src/main.rs')
| -rw-r--r-- | ai/src/main.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ai/src/main.rs b/ai/src/main.rs new file mode 100644 index 0000000..dcedcb5 --- /dev/null +++ b/ai/src/main.rs @@ -0,0 +1,25 @@ +use ai::TranspositionTable; + +const DEPTH: u8 = 18; + +fn main() { + let board = ai::CheckersBitBoard::starting_position(); + let mut table = TranspositionTable::new(50_000); + let mut alpha = -1.0; + let mut beta = 1.0; + for i in 0..DEPTH { + let mut eval = ai::negamax(i, alpha, beta, board, table.mut_ref()); + + if (eval <= alpha) || (eval >= beta) { + eval = ai::negamax(i, -1.0, 1.0, board, table.mut_ref()); + } + + alpha = f32::max(eval + 0.125, -1.0); + beta = f32::min(eval + 0.125, 1.0); + } + + println!( + "{:?}", + ai::negamax(DEPTH, alpha, beta, board, table.mut_ref(),) + ); +} |
