Im trying to make a poker game with in python using pygame and OOP. I previously made a text based blackjack game from a udemy course and im trying to use some of the same principles to create my deck but its not working. The problem I have is I want to create 52 card objects and I want each card object to have three attributes (suit, rank, and a png file).
class Card:
def __init__(self, suit, rank, pic):
self.suit = suit
self.pic = pic
self.rank = rank
class Deck:
def __init__(self):
self.deck_comp = []
def create_deck(self):
for suit in suits:
for rank in ranks:
for pic in deck:
self.deck_comp.append(Card(suit, rank, pic))
I have a feeling the three for loops are the problem. In the text based blackjack game the card only needed to have two attributes. For this game I need the card objects to have a picture and a value and suit so I can display them and compare them.
suit is a list of the four suit strings Rank is a list of card names as strings and pic is a list of 52 .png files (one for each card in the deck)