diff options
Diffstat (limited to 'Varty's Cardy v1.py')
-rw-r--r-- | Varty's Cardy v1.py | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Varty's Cardy v1.py b/Varty's Cardy v1.py new file mode 100644 index 0000000..3ef90af --- /dev/null +++ b/Varty's Cardy v1.py @@ -0,0 +1,103 @@ +import random + +players = 6 +cards = [] +place = random.randrange(players) +print(f"You are in place: {place+1}") + +for i in range(players): + cards.append(random.randrange(1, 14)) + if cards[i] == 13: + print(f"Player in place {i+1} gets a King! ") + +print(f"Your card is: {cards[place]}") + +for i in range(1, players): + # print(cards) + if i == place: + if i != players-1: + if cards[i+1] != 13: + print("Your turn!") + choice = bool(int(input("Do you want to swap with the player after you (0 - No, 1 - Yes): "))) + if choice: + (cards[i], cards[i+1]) = (cards[i+1], cards[i]) + print(f"Card swapped! Current card: {cards[i]}") + else: + print("Card saved! ") + else: + print("Your turn, but you can't swap ~") + else: + if cards[0] != 13: + print("Your turn!") + choice = bool(int(input("Do you want to swap with the player after you (0 - No, 1 - Yes): "))) + if choice: + (cards[i], cards[0]) = (cards[0], cards[i]) + print(f"Card swapped! Current card: {cards[0]}") + else: + print("Card saved! ") + else: + print("Your turn, but you can't swap ~") + else: + if i != players-1: + if cards[i+1] != 13: + level = random.randrange(3, 9) + if cards[i] >= level: + print(f"Player {i+1} decided not to swap their card ...") + else: + (cards[i], cards[i+1]) = (cards[i+1], cards[i]) + if i+1 == place: + print(f"Player {i+1} swapped with you! Current card: {cards[i+1]}") + else: + print(f"Player {i+1} decided to swap with Player {i+2} ...") + else: + print(f"Player {i+1} can't swap ~ ") + else: + if cards[0] != 13: + level = random.randrange(3, 9) + if cards[i] >= level: + print(f"Player {i+1} decided not to swap their card ...") + else: + (cards[i], cards[0]) = (cards[0], cards[i]) + if 0 == place: + print(f"Player {i+1} swapped with you! Current card: {cards[0]}") + else: + print(f"Player {i+1} decided to swap with Player 1 ...") + else: + print(f"Player {i+1} can't swap ~ ") + +if place == 0: + print("You have a chance to choose another card! ") + choice = bool(int(input("Do you want to continue? (0 - No, 1 - Yes): "))) + if choice: + cards[0] = random.randrange(1, 14) + print(f"Current card: {cards[0]}") + else: + print("Card saved! ") +else: + level = random.randrange(3, 9) + if cards[0] >= level: + print("Player 1 decided not to change their card ...") + else: + cards[0] = random.randrange(1, 14) + print("Player 1 decided to change their card ...") + +lowest = 13 +losers = [] +for i in range(players): + if cards[i] < lowest: + losers = [i] + lowest = cards[i] + elif cards[i] == lowest: + losers.append(i) + +for i in losers: + print(f"Player {i+1}", end=" ") +print("lost! ") + +if place in losers: + print("You lost! ") +else: + print("You won! ") + +for i in range(players): + print(f"Player {i+1}'s card: {cards[i]}") |