playHand :: (Player, Player) -> (Player, Player)
playHand ((Player health1 mana1 cards1 d1), (Player health2 p2m p2c d2)) =
  let newCard = head d1
      newDeck = drop 1 d1
      (totalDamage, handLeft, manaLeft) =
        foldr
        (\card (dam, hand, mana) ->
           if (card <= mana) then
             (dam+card, hand, mana-card)
           else
             (dam, card:hand,mana))
        (0, [], mana1)
        (sort (newCard:cards1))
      p2 = Player (health2 - totalDamage) p2m p2c d2
      p1 = Player health1 manaLeft handLeft newDeck
  in (p2, p1)
playHand :: (Player, Player) -> (Player, Player)
playHand ((Player health1 mana1 cards1 d1), (Player health2 p2m p2c d2)) =
  let newCard = head d1
      newDeck = drop 1 d1
      (totalDamage, handLeft, manaLeft) =
        foldr
        (\card (dam, hand, mana) ->
           if (card <= mana) then
             (dam+card, hand, mana-card)
           else
             (dam, card:hand,mana))
        (0, [], mana1)
        (sort (newCard:cards1))
      p2 = Player (health2 - totalDamage) p2m p2c d2
      p1 = Player health1 manaLeft handLeft newDeck
  in (p2, p1)
playHand ((Player health1 mana1 cards1 d1), (Player health2 p2m p2c d2)) =
  let newCard = head d1
      newDeck = drop 1 d1
      (totalDamage, handLeft, manaLeft) =
        foldr
        (\card (dam, hand, mana) ->
           if (card <= mana) then
             (dam+card, hand, mana-card)
           else
             (dam, card:hand,mana))
        (0, [], mana1)
        (sort (newCard:cards1))
      p2 = Player (health2 - totalDamage) p2m p2c d2
      p1 = Player health1 manaLeft handLeft newDeck
  in (p2, p1)