summaryrefslogtreecommitdiff
path: root/ai/src/main.rs
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2023-09-27 09:35:50 -0400
committerMicha White <botahamec@outlook.com>2023-09-27 09:35:50 -0400
commit1b379403ab971e188483df5d580c39695db7f44a (patch)
treef9d547fe9d4bf0fd7c8ddabcf5e6fd119a9ff6bf /ai/src/main.rs
parent10438fa9ae1dc4624ebb1780238d46d4b5d3f0eb (diff)
Big changes
Diffstat (limited to 'ai/src/main.rs')
-rw-r--r--ai/src/main.rs25
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(),)
+ );
+}