b0VIM 7.2Bé N•ò™Ojulianalucenajuliana.local~julianalucena/cin/8-periodo/funcional/mancala/Rules.hsutf-8 3210#"! UtpEadµåEôáàȲ™‚gO,+÷öЭwON ý ß ¨ § ‚ ^ C  ò Ü « u >   Ö ³ £  .  é Ä Ã ž d > *  ø ÷ ß Â ² Ž j S $ õôШ‰uL(å where player where playerHoles = getPlayerHoles player b | otherwise = True | playerHoles !! pos == 0 = False | pos > length playerHoles - 2 = False | pos < 0 = FalseisPossibleMove (player, pos) bisPossibleMove :: Hole -> Board -> Bool-- Verify if is a possible movement playerBSeeds = foldr (+) 0 (snd board) where playerASeeds = foldr (+) 0 (fst board) | otherwise = Nobody | playerASeeds < playerBSeeds = B | playerASeeds > playerBSeeds = AgetWinner boardgetWinner :: Board -> Player-- Retrieves the winner | otherwise = False | isMancala hole b = TruecanMoveAgain hole bcanMoveAgain :: Hole -> Board -> Bool-- (based on last hole that received a seed after a move)-- Verify if the user can move again boardAfterMove = move hole b where lastHole = getLastHole hole b | otherwise = boardAfterMove canCapture lastHole boardAfterMove == True = capture lastHole boardAfterMove | (fst lastHole) == (fst hole) &&makeMove hole bmakeMove :: Hole -> Board -> Board-- Make a move and capture if it is possible otherPlayerHoles = (getOtherPlayerHoles player b) opositePos = length otherPlayerHoles - pos - 2 opositeSeeds = otherPlayerHoles !! opositePos where seeds = (getPlayerHoles player b) !! pos | otherwise = False | seeds == 1 && opositeSeeds /= 0 = True | isMancala (player, pos) b = FalsecanCapture (player, pos) bcanCapture :: Hole -> Board -> Bool-- Verifies if a capture can be done where holes = removeMancalaHole (getPlayerHoles p b)hasMove p b = any (/=0) holeshasMove :: Player -> Board -> Bool-- Verify if specified player has moves to do where holes = getPlayerHoles player bisMancala (player, pos) b = (length holes - 1) == posisMancala :: Hole -> Board -> Bool-- Indicates if the hole is a mancalaimport Data.List(splitAt)import Boardimport Types isPossibleMove) where getWinner, canMoveAgain, makeMove, canCapture, hasMove,module Rules(isMancala,-- Mancala's rules-- Rules.hs