Terminal Game - Blackjack

Hey all! Looking for some feedback on my terminal game. I made a simple version of blackjack, with as many players as you’d like. There’s no feature for splitting or doubling down but those could be fairly easy to implement. Thanks in advance!


I’d ditch the Deck class, you’re pretty much doing all the work in Player currently. You’re also random picking after you’ve shuffled, which seems redundant.

Make a Card class instead. This could answer some questions for you and make it easier to compare faces.


class Card:
    SUITS = ['H','D','C','S']
    FACES = ['A','2','3','4','5','6','7','8','9','10','J','Q','K']
    def __init__(self, face, suit):
        self.face, self.suit = face, suit
    def face_name(self):
        return Card.FACES[self.face]
    def suit_name(self):
        return Card.SUITS[self.suit]
    def __repr__(self):
        return "{}{}".format(self.face_name(), self.suit_name())
    def is_ten(self):
        return self.face > 8
    def is_ace(self):
        return self.face == 0

def new_deck(boot_size = 1, shuffle = False):
    result = []
    for _ in range(boot_size):
        result += [Card(i % 13, i // 13) for i in range(52)]
    if shuffle:
        for i in range(len(result) - 1, -1,-1): # backwards, easier for shuffle
            pick = random.randint(0, i)
            result[i], result[pick] = result[pick], result[i]
    return result

Note that face and suit are numeric. This makes worrying out “tens” pretty simple. It also means you could change the text representation with little worry.