Skip to content

Instantly share code, notes, and snippets.

@AumCoin
Created February 2, 2018 02:38
Show Gist options
  • Save AumCoin/61368febca3e8577082376bb266130e6 to your computer and use it in GitHub Desktop.
Save AumCoin/61368febca3e8577082376bb266130e6 to your computer and use it in GitHub Desktop.
import random
import playingcard
class Hand(slef,numCardsInHand)
def __init__(self,numCardsInHand):
self.numCardsInHand = numCardsInHand
cards = []
# Generate cards randomly and add to cards[]
suits = ["h","c","d","s"]
while(numCardsInHand > 0)
#generate a card and add to hand
hitMe()
# decrement numCardsinHand
numCardsInHand -= 1
def bjValue(self):
total = 0
for card in self.cards
total += card.bjValue()
return total
def __str__(self):
for card in self.numCards
print(card)
def hitMe(self):
# Add a randomly generated card to hand
suit = suits[random.randint(0,3)]
rank = random.randint(0,12)
cards.append(playingcard.PlayingCard(suit,rank)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment