Проект блэкджека вытягивает карту на стендеPython

Программы на Python
Ответить
Anonymous
 Проект блэкджека вытягивает карту на стенде

Сообщение Anonymous »

Код: Выделить всё

import random
import math

playerIn = True
dealerIn = True

#deck
deck = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]

dealerHand = [] #beginning dealer hand [X-0, firstcard-1, secondcard-2]
playerHand = []

def dealerCardsDealt():
for x in range(2):
card = random.choice(deck)
dealerHand.append(card)
deck.remove(card)
x += 1

def playerCardsDealt():
for x in range (2):
card = random.choice(deck)
playerHand.append(card)
deck.remove(card)
x += 1

#calculate player total
def playerTotal():
total = 0
for card in playerHand:
if card in ["2", "3", "4", "5", "6", "7", "8", "9", "10"]:
total += int(card)
elif card in ["J", "Q", "K"]:
total += 10
elif card in ["A"]:
if total > 10:
total += 1
elif total  10:
total += 1
elif total 

Подробнее здесь: [url]https://stackoverflow.com/questions/79371189/blackjack-project-draws-card-on-stand[/url]
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»