There is a python script to make your Uno Games
pop(0)) splitCard = discards.split(" ", 1) currentColour = splitCard if currentColour != "Wild": cardVal = splitCard else: cardVal = "Any" while playing: showHand(playerTurn, players[playerTurn]) print("Card on top of discard pile: {}".format(discards[-1])) if canPlay(currentColour, cardVal, players[playerTurn]):
id: 61e10f94510116904e81c982464a5e4e - page: 2
")) while not canPlay(currentColour, cardVal, [players[playerTurn][cardChosen-1]]): cardChosen = int( input("Not a valid card. Which card do you want to play?")) print("You played {}".format(players[playerTurn][cardChosen-1])) discards.append(players[playerTurn].pop(cardChosen-1)) # cheak if player won if len(players[playerTurn]) == 0: playing = False # winner = "Player {}".format(playerTurn+1) winner = players_name[playerTurn] else: # cheak for special cards splitCard = discards[-1].split(" ", 1) currentColour = splitCard if len(splitCard) == 1: cardVal = "Any" else: cardVal = splitCard if currentColour == "Wild": for x in range(len(colors)): print("{}) {}".format(x+1, colors[x])) newColour = int( input("What colour would you like to choose? ")) while newColour < 1 or newColour > 4: newColour = int( input("Invalid option. What colour would you like to choose")) currentColour = colors[newColour-1] if cardVal == "Reverse": pla
id: 036d8e09b1525178d2091dde7f3c83e9 - page: 3
extend(drawCards(2)) elif cardVal == "Draw Four": playerDraw = playerTurn+playDirection if playerDraw == numPlayers: playerDraw = 0 elif playerDraw < 0: playerDraw = numPlayers-1 players[playerDraw].extend(drawCards(4)) print("") else: print("You can't play. You have to draw a card.") players[playerTurn].extend(drawCards(1)) playerTurn += playDirection if playerTurn >= numPlayers: playerTurn = 0
id: 03b09139b128fc92c088742115210f42 - page: 3
".format(winner))
id: 5aca65e2e44430ee880de20aab4546f5 - page: 4