#UNO Python
6 messages · Page 1 of 1 (latest)
We don't encourage people DMing.
Maybe frame your question more in the terms of "help" rather than "do".
@gilded bison
✅ Formatting - Success
import random
rules = input("Do you know the rules of UNO? [YES/NO] ")
if rules.lower() == "yes":
print("Great! Start Playing!")
if rules.lower() == "no":
print(
"To win, get rid of all your cards. Each player takes turns, you can place a card in the middle if the color or number of your card is matching the color or number of the middle card. "
)
players = int(input("Select the amount of players: [2-4] "))
cardamount = int(input("Select the amount of cards each player receives: [6-8] "))
cards = []
for color in "RYBG":
cards.append(color + "0")
for number in range(1, 10):
cards.append(color + str(number))
cards.append(color + str(number))
random.shuffle(cards)
middlenumber = cards.pop()
print("The card in the middle is:", middlenumber)
playerhands = []
for _ in range(players):
hand = []
for _ in range(cardamount):
card = cards.pop()
hand.append(card)
playerhands.append(hand)
def play_turn(deck1):
for x in deck1:
if x[0] == middlenumber[0] or x[1] == middlenumber[1]:
deck1.remove(x)
break
playerturn = 0
running = True
while running:
playerturn += 1
if playerturn >= players:
playerturn = 0
play_turn(playerhands[playerturn])
print(playerhands)
for deck in playerhands:
if len(deck) == 0:
running = False
print(playerhands)
So, what do you need help with? @exotic tangle
@exotic tangleWhat do you need man>