Orasund / elm-game-ai-minimax / MinimaxSearch

This library implements minimax algorithm with alpha-beta pruning.

findBestMove : { apply : move -> game -> game, evaluate : game -> Evaluation, possibleMoves : { isYourTurn : Basics.Bool } -> game -> List move, searchDepth : Basics.Int } -> game -> Maybe move

Computes the best move


type Evaluation
    = Winning
    | Loosing
    | Score Basics.Int

Evaluation of a game

negateEvaluation : Evaluation -> Evaluation

negates a evaluation

negateEvaluation Winning --> Loosing negateEvaluation Loosing --> Winning negateEvaluation (Score 42) --> Score -42