Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boardFromMinmax:: Board->Color->Board
- boardFromMinmax board color = bestBoard
- where
- movesPossibleNow = possibleMoves board --mozliwe ruchy
- trees = map (\move -> (generateTree (addToBoard board move color) maxDepth color)) movesPossibleNow --dla kazdego mozliwego ruchu plansza
- maxDepth = 2 --maksymalna glebokosc dla minmaxa
- minMaxMoves = map (minimax color maxDepth True) trees --minmax dla kazdego mozliwego ruchu
- index = fromJust(elemIndex (maximum minMaxMoves) minMaxMoves) --indeks gdzie minmax jest maksymalny
- bestBoard = addToBoard (movesPossibleNow !! index) color --plansza z ruchem gdzie minmax jest najwiekszy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement