Advertisement
Coriic

Untitled

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