Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minmaxAlfa [] color level maxLevel alfa beta = alfa
- minmaxAlfa (x:xs) color level maxLevel alfa beta
- | (newAlfa>=beta) = beta
- | otherwise = minmaxAlfa xs color level maxLevel newAlfa beta
- where
- newAlfa = max alfa (exploreTree x color level maxLevel alfa beta)
- minmaxBeta [] color level maxLevel alfa beta = beta
- minmaxBeta (x:xs) color level maxLevel alfa beta
- | (alfa >= newBeta) = alfa
- | otherwise = minmaxBeta xs color level maxLevel alfa newBeta
- where
- newBeta = min beta (exploreTree x color level maxLevel alfa beta)
- exploreTree (Node node children) color level maxLevel alfa beta
- | Prelude.null children = rateBoard node color
- | level>maxLevel = if (level `mod` 2 == 0) then maximum (rateBoards children color) else minimum (rateBoards children color)
- | level `mod` 2 == 0 = minmaxBeta children color (level+1) maxLevel alfa beta
- | otherwise = minmaxAlfa children color (level+1) maxLevel alfa beta
- minmax (Node node children) color maxLevel = exploreTree (Node node children) color 0 maxLevel (-1000) 1000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement