Backend logic for general card games.