Created
February 2, 2018 02:38
-
-
Save AumCoin/61368febca3e8577082376bb266130e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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