generated from mwc/project_game
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
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():
|
|
|
|
|
|
#deal two cards to the dealer one up and one down
|
|
dealer_show = Card()
|
|
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()
|
|
|
|
|
|
|
|
|