made some updates to card and dealer to deal with face cards

This commit is contained in:
jandrews
2025-12-18 10:57:32 -05:00
parent 7d7d2a71d1
commit 95ae6740d3
3 changed files with 36 additions and 5 deletions

Binary file not shown.

View File

@@ -11,5 +11,9 @@ class Card:
def deal(self):
self.face = randint(1, 11)
#I think here we should return 1-13 to include ace and face cards.
#This will make checking if 4 of a kind have been dealt easier.
#THEN when it comes to scoring we can use the value to calculate face cards as 10 points.
return self.face

View File

@@ -2,18 +2,45 @@ import retro
from card import Card
#this code will be for creating a player to play against or to deal cards and to ask about your next action to continue the game.
#this code will be the agent refered to as dealer for now.
dealer_hand=[]
player1_hand=[]
def deal_first():
def deal_first:
dealer_hand=[]
player1_hand=[]
#deal two cards to the dealer one up and one down
dealer_show = Card()
print("dealer shown card:"+ dealer_show)
while is_card_valid(dealer_show) == False:
dealer_show = Card()
if dealer_show == 1:
print("dealer shown card:"+ "Ace")
if dealer_show == 10:
print("dealer shown card:"+ "Jack")
#continue code here to show the correct face based on what was drawn
print("dealer shown card:"+ str(dealer_show))
dealer_hand.append(dealer_show)
dealer_hidden = Card()
print("")
dealer_hand.append(dealer_hidden)
#deal two cards to the player (both showing since it's one player)
def is_card_valid(card):
cards_dealt = []
for card_face in cards_dealt:
if card_face == card:
return False
else:
cards_dealt.append(card)
return True
deal_first()