I need some help organizing my functions, methods and classes.
I have a card class that returns a card value
I have a dealer file that has a function that deals the first two cards
I'm still a little lost on how this works into the Game class
and how to organize the play.
I want to:
1. deal two cards to each dealer and player
2. hide one of the dealers cards
3. present the user with their cards and let them
choose * hit me OR * stay.
4. If they hit, deal another card to them and calculate if they
went over 21.  If they went over 21 end the game with BUST Dealer WINS!.
If they didn't go over 21, calculate their score and allow the dealer
their turn.
5. If they stay, calculate their score and let the dealer have their turn.
6. Dealer - checks their cards and compares them to the player.  Then
chooses to hit or stay.  Print choice to screen.  If they hit, show the card
to the player.
This commit is contained in:
jandrews
2025-12-18 10:21:56 -05:00
parent c8f316ecfb
commit 7d7d2a71d1
8 changed files with 52 additions and 0 deletions

19
dealer.py Normal file
View File

@@ -0,0 +1,19 @@
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.
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)
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)