------------------------------------------------------------------------------
-- | Is there a legal move?
anyMove :: Board -> Bool
anyMove b =
  let pins' = pinned b
      checkers = attackedFromBB b (occupancy b) (b^.B.opponent) (myKingPos b)
  in if checkers /= mempty
     then any (legal b) $ defendCheck b checkers
     else or [ any (ok b pins') ms
             | ms <- [ quietMoves b
                     , pawnQuietMoves b
                     , captures b
                     , pawnCaptures b
                     , simpleChecks b
                     , pawnSimpleChecks b
                     , discoveredChecks b
                     , pawnDiscoveredChecks b
                     , pawnEnPassants b
                     , pawnPromotions b
                     ]
             ]
anyMove :: Board -> Bool
anyMove b =
  let pins' = pinned b
      checkers = attackedFromBB b (occupancy b) (b^.B.opponent) (myKingPos b)
  in if checkers /= mempty
     then any (legal b) $ defendCheck b checkers
     else or [ any (ok b pins') ms
             | ms <- [ quietMoves b
                     , pawnQuietMoves b
                     , captures b
                     , pawnCaptures b
                     , simpleChecks b
                     , pawnSimpleChecks b
                     , discoveredChecks b
                     , pawnDiscoveredChecks b
                     , pawnEnPassants b
                     , pawnPromotions b
                     ]
             ]
anyMove b =
  let pins' = pinned b
      checkers = attackedFromBB b (occupancy b) (b^.B.opponent) (myKingPos b)
  in if checkers /= mempty
     then any (legal b) $ defendCheck b checkers
     else or [ any (ok b pins') ms
             | ms <- [ quietMoves b
                     , pawnQuietMoves b
                     , captures b
                     , pawnCaptures b
                     , simpleChecks b
                     , pawnSimpleChecks b
                     , discoveredChecks b
                     , pawnDiscoveredChecks b
                     , pawnEnPassants b
                     , pawnPromotions b
                     ]
             ]