TU-CSCI2322-FL24 / solver-four-fellow-s-morris

solver-four-fellow-s-morris created by GitHub Classroom
0 stars 0 forks source link

mill should only check the destination of the last piece #15

Open sfogarty opened 2 hours ago

sfogarty commented 2 hours ago
mill :: Point -> Board -> Player -> Bool
mill pieceLoc board pl =
    let adjacentMills = [mill | mill <- allMills, pieceLoc `elem` mill]
        playerFilled mill = all (\l -> lookup l board == Just pl) mill
    in any playerFilled adjacentMills
sfogarty commented 2 hours ago

Use this in makeMove/actionResult on the destination of whatever piece (for a put or move, but not a remove), if it's true then don't swap the player and set the "must remove" bool to true.