Module minimax

Module minimax 

Source
Expand description

Minimax Game Tree Search Implementation Module

This module implements a game tree search using min-max strategy, alpha-beta pruning, and a transposition table. The game-specific components are provided by the user using the traits defined in other modules.

§Example

use std::cell::RefCell;
use std::rc::Rc;
use crate::minimax::{search, ResponseGenerator};
use crate::transposition_table::TranspositionTable;

// Assuming you have implemented the required traits for your game
let tt = Rc::new(RefCell::new(TranspositionTable::new(1000, 100)));
let static_evaluator = MyStaticEvaluator::new();
let response_generator = MyResponseGenerator::new();
let initial_state = Rc::new(MyGameState::new());

if let Some(best_move) = search(&tt, &static_evaluator, &response_generator, &initial_state, 6) {
    println!("Best move found: {:?}", best_move);
}

§Notes

  • The search assumes a two-player zero-sum game with perfect information.
  • The transposition table can be reused across multiple searches for efficiency and support of iterative deepening.

Traits§

ResponseGenerator
Response generator function object trait.

Functions§

search
A minimax search implementation using alpha-beta pruning and a transposition table.