An engine for card games