hstzaar-0.9: src/AI.hs
-- | Library of AI Players
module AI (aiPlayers) where
import Board
import AI.Tree
import AI.Minimax
import AI.Eval
-- import Debug.Trace
-- all AI players; ply depth >1 do not necessarily play better!
aiPlayers :: [(String,AI)]
aiPlayers = [ (l,ply l d) | n<-[0..3], let d=max 1 (2*n+1), let l="Level "++show n]
{-
aiPlayers = zipWith (\n ai -> (n,ai n)) names levels
where levels = basic : [ply (3*n) | n<-[1,2,3]]
names = ["Level " ++ show n | n<-[0..3]]
-- basic AI: material evaluation, depth 1
basic n = AI { name = n
, description = "Minimax alpha-beta depth 3"
, strategy = negamaxStrategy 3 eval0
}
-}
-- better AI, parameterized by ply depth
ply :: String -> Int -> AI
ply n d = AI { name = n
, description = "Minimaxing with alpha-beta ply " ++ show d
, strategy = singleMoves $ negamaxStrategy d eval1
{-
withBoard $
\b -> let m = minimum (countStacks (active b) (pieces b) ++
countStacks (inactive b) (pieces b))
d' = if m<=3 then d else 3
in negamaxStrategy d' eval1 -}
}