Handle face cards by treating face and value as distinct concepts. Report deck size with each message. Now the question: how can this simple application chew up 8GB of RAM + swap when the shuffle happens to result in an infinite run of the game?