import os import time import random import sys def typing_effect1(text): for char in text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.1) print() def typing_effect2(text): for char in text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.05) print() CGREEN = '\33[32m' CYELLOW = '\33[93m' CORANGE = '\33[33m' CRED = '\033[91m' CPURPLE = '\33[95m' CBLUE = '\33[34m' CEND = '\033[0m' key_number = 0 name = 'unknown' def start(): print("\033c") logo() print ("Welcome to the " + CGREEN + "Duelerious " + CEND + "universe, the center of all duals and bets. ") time.sleep(2) print ("Within the " + CGREEN + "Duelerious " + CEND + "universe there are " + CBLUE + "3 planets" + CEND + ".") time.sleep(2) print ("Here's the thing: You aren't just competing for fun... ") time.sleep(2) print("You're competing for a chance to over throw the Lord of Duelerious and claim the " + CYELLOW + "crown!" + CEND) time.sleep(2) print("You can compete on any of the planets in any order, and each time you conquer the leader of that planet you will aquire 1 of three keys.") time.sleep(3) print("When you have 3 keys you can unlock the door to the Lords Lair in the center of the universe") time.sleep(3) print() namequestion = input("What is your name, fearless one? ") name = namequestion print(f"Now, now. Enough chitchat, {name}. You better get started on your " + CYELLOW + "quest!" + CEND) time.sleep(3) planet_chose = input(CRED + "Planet [B]lackjackeron" + CEND + ", " + CPURPLE + "Planet [P]SR" + CEND + ", " + CBLUE + "Planet [U]nknown " + CEND + "or " + CGREEN + "[M]ore Info" + CEND + ": ") if planet_chose.lower() == 'b': typing_effect1("Tele-importing you to Planet Blackjackeron...") time.sleep(2) print("\033c") blackjack() elif planet_chose.lower() == 'p': typing_effect1("Tele-importing you to Planet PSR...") time.sleep(2) print("\033c") papersissorsrock() elif planet_chose.lower() == 'u': typing_effect1("Tele-importing you to Planet Unknown...") time.sleep(2) print("\033c") elif planet_chose.lower() == 'm': typing_effect1("Tele-importing you to the Info Center") time.sleep(2) print("\033c") def back2start(): print("\033c") stamped_logo() print (f"Welcome back, {name}! You have {key_number} key(s)! ") planet_chose = input(CRED + "Planet [B]lackjackeron" + CEND + ", " + CPURPLE + "Planet [P]SR" + CEND + ", " + CBLUE + "Planet [U]nknown " + CEND + "or " + CGREEN + "[M]ore Info" + CEND + ": ") if planet_chose.lower() == 'b': typing_effect1("Tele-importing you to Planet Blackjackeron...") time.sleep(2) print("\033c") blackjack() elif planet_chose.lower() == 'p': typing_effect1("Tele-importing you to Planet PSR...") time.sleep(2) print("\033c") papersissorsrock() elif planet_chose.lower() == 'u': typing_effect1("Tele-importing you to Planet Unknown...") time.sleep(2) print("\033c") elif planet_chose.lower() == 'm': typing_effect1("Tele-importing you to the Info Center") time.sleep(2) print("\033c") def blackjack(): total_deck = 0 def display_banner(): print (CRED + "▀███▀▀▀██▄▀███ ▀███ ▀████▀ ▀███ ") time.sleep(0.3) print (" ██ ██ ██ ██ ██ ██ ") time.sleep(0.3) print (" ██ ██ ██ ▄█▀██▄ ▄██▀██ ██ ▄██▀ ██ ▄█▀██▄ ▄██▀██ ██ ▄██▀ ") time.sleep(0.3) print (" ██▀▀▀█▄▄ ██ ██ ██ ██▀ ██ ██ ▄█ ██ ██ ██ ██▀ ██ ██ ▄█ ") time.sleep(0.3) print (" ██ ▀█ ██ ▄█████ ██ ██▄██ ██ ▄█████ ██ ██▄██ ") time.sleep(0.3) print (" ██ ▄█ ██ ██ ██ ██▄ ▄ ██ ▀██▄ ███ ██ ██ ██ ██▄ ▄ ██ ▀██▄ ") time.sleep(0.3) print ("▄████████ ▄████▄████▀██▄█████▀▄████▄ ██▄▄█████ ▀████▀██▄█████▀▄████▄ ██▄▄" ) time.sleep(0.3) print("---------------------------------------------------------------------------") time.sleep(0.3) print("From Planet BlackJackeron" + CEND) print() def banner_stamp(): print (CRED + "▀███▀▀▀██▄▀███ ▀███ ▀████▀ ▀███ ") print (" ██ ██ ██ ██ ██ ██ ") print (" ██ ██ ██ ▄█▀██▄ ▄██▀██ ██ ▄██▀ ██ ▄█▀██▄ ▄██▀██ ██ ▄██▀ ") print (" ██▀▀▀█▄▄ ██ ██ ██ ██▀ ██ ██ ▄█ ██ ██ ██ ██▀ ██ ██ ▄█ ") print (" ██ ▀█ ██ ▄█████ ██ ██▄██ ██ ▄█████ ██ ██▄██ ") print (" ██ ▄█ ██ ██ ██ ██▄ ▄ ██ ▀██▄ ███ ██ ██ ██ ██▄ ▄ ██ ▀██▄ ") print ("▄████████ ▄████▄████▀██▄█████▀▄████▄ ██▄▄█████ ▀████▀██▄█████▀▄████▄ ██▄▄" ) print("---------------------------------------------------------------------------") print("From Planet BlackJackeron" + CEND) print() def deal_card(): card = random.choice([2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace']) if card == 'Ace': value = input("You pulled an Ace. Do you want the Ace to be a [1] or an [11]? ").lower() while value not in ['1', '11']: print("Invalid input! Please pick 1 or 11") value = input("You pulled an Ace. Do you want the Ace to be a [1] or an [11]? ").lower() print(f'Your Ace is now worth {value} point(s)') return int(value) elif card in ['Jack', 'Queen', 'King']: print(f"You picked up a {card} worth 10 points") return 10 else: print(f"You picked up a simple {card}") return card def dealer_card(): deal_dealer = random.choice([2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace']) if deal_dealer == 'Ace': if total_dealerdeck <= 10: Ace = 11 elif total_dealerdeck > 10: ace = 1 print(CRED+ "King Jack " + CEND + f"has picked up an Ace and valued it at {Ace}") total_dealerdeck =+ Ace elif deal_dealer in ['Jack', 'Queen', 'King']: print(CRED+ "King Jack " + CEND + f"Dealer picked up a {deal_dealer} worth 10 points") return 10 else: print(CRED+ "King Jack " + CEND + f"Dealer picked up a simple {deal_dealer}") return deal_dealer def play_round(): print("Welcome to Planet BlackJackeron. The King of the planet, " + CRED + "King Jack Nefarious" + CEND + ", has challenged you to a duel... card game style.") time.sleep(2) print("He welcomes you but warns you that he has practiced the arts of Black Jack for centuries.") time.sleep(2) print("However he says he raclls an ancient prophecy of a mere human who will change Duelerious' history forever...") time.sleep(2) print() global total_deck total_deck = 0 dealersdeck = 0 dealersdeck += dealer_card() print(CRED+ "King Jack " + CEND + "picked up one other card...") print() total_deck += deal_card() total_deck += deal_card() print() print(f"Your total: {total_deck}") while total_deck <= 21: hop = input("Do you want to [h]it or [p]ass? ") if hop == 'h': total_deck += deal_card() print(f"Your total: {total_deck}") elif hop == 'p': break else: print("Invalid input! Please choose 'h' or 'p'. ") print() while dealersdeck < 17: dealersdeck += dealer_card() print(CRED+ "King Jack's " + CEND + f"total: {dealersdeck}") if total_deck <= 21: if dealersdeck > 21 or total_deck > dealersdeck: print("You won!") key_number = key_number + 1 elif total_deck == dealersdeck: print("It's a tie!") else: print ("You lost!") else: print("You busted! "+ CRED + "Dealer " + CEND + "wins.") end_game() def end_game(): print() restart = input("Type m to go back to menu: ") if restart == 'm': menu() menu() def start_game(): os.system('cls||clear') banner_stamp() play_round() def show_rules(): print("1. The dealer shuffles the deck and deals two cards to each player, including themselves. All cards are dealt face up.") time.sleep(2) print("2. Each player's hand is the sum of the card values. Players can see their own cards but not the dealer's other card.") time.sleep(2) print("3. A ton of other rules, ect, ect, ect.") def dock_teleport(): back2start() os.system('cls||clear') def menu(): os.system('cls||clear') display_banner() start = input("[s]tart, [r]ules or [t]teleport home: ").lower() if start == "s": start_game() elif start == "r": show_rules() print() restart = input("Type m to go back to menu: ") if restart == 'm': menu() elif start == "t": dock_teleport() print() restart = input("Type m to go back to menu: ") if restart == 'm': menu() else: menu() while True: menu() def papersissorsrock(): def psrpro(): print(CGREEN + "▀███▀▀▀██▄ ▄█▀▀▀█▄████▀▀▀██▄ ▀███▀▀▀██▄▀███▀▀▀██▄ ▄▄█▀▀██▄ ") time.sleep(0.3) print(" ██ ▀██▄██ ▀█ ██ ▀██▄ ██ ▀██▄ ██ ▀██ ██▀ ▀██▄") time.sleep(0.3) print(" ██ ▄██▀███▄ ██ ▄██ ██ ▄██ ██ ▄██ ██▀ ▀██") time.sleep(0.3) print(" ███████ ▀█████▄ ███████ ███████ ███████ ██ ██") time.sleep(0.3) print(" ██ ▄ ▀██ ██ ██▄ ██ ██ ██▄ ██▄ ▄██") time.sleep(0.3) print("▄████▄ █▀█████▀▄████▄ ▄███▄ ▄████▄ ▄████▄ ▄███▄ ▀▀████▀▀ " + CEND) time.sleep(0.3) print("-----------------------------------------------------------------") time.sleep(0.3) print("From Planet PSR") print() def banner(): print(CGREEN + "▀███▀▀▀██▄ ▄█▀▀▀█▄████▀▀▀██▄ ▀███▀▀▀██▄▀███▀▀▀██▄ ▄▄█▀▀██▄ ") print(" ██ ▀██▄██ ▀█ ██ ▀██▄ ██ ▀██▄ ██ ▀██ ██▀ ▀██▄") print(" ██ ▄██▀███▄ ██ ▄██ ██ ▄██ ██ ▄██ ██▀ ▀██") print(" ███████ ▀█████▄ ███████ ███████ ███████ ██ ██") print(" ██ ▄ ▀██ ██ ██▄ ██ ██ ██▄ ██▄ ▄██") print("▄████▄ █▀█████▀▄████▄ ▄███▄ ▄████▄ ▄████▄ ▄███▄ ▀▀████▀▀ ") print("Paper, Scissors, Rock! 1983 Pro Edition" + CEND) print() def menu(): os.system('cls||clear') psrpro() start = input("[s]tart, [r]ules or [t]eleport home: ").lower() if start == "s": start_game() elif start == "r": show_rules() print() restart = input("Type m to go back to menu: ") if restart == 'm': menu() elif start == "t": dock_teleport() def start_game(): os.system('cls||clear') banner() print("The King of Planet PSR hovers down from above and lands in front of you.") print("He has heard you have ventured far to reach the Deulerious Universe, and wants to put you to the test.") print("He hands you a scroll with the rules:") print("1. Cheating is punishable by death") print("2. Best of 3 games") print("3. If you beat me you aquire my Crown. If you lose you die.") computer = random.randint(1-3) if computer == '1': print() def show_rules(): print("If you don't know how to play Rock Paper Scissors, then maybe you should contemplate your own life") def dock_teleport(): back2start() menu() def logo(): print(CGREEN + "▀███▀▀▀██▄ ▀███ ██ " + CEND) time.sleep(0.7) print(CYELLOW + " ██ ▀██▄ ██ " + CEND) time.sleep(0.7) print(CORANGE + " ██ ▀█████ ▀███ ▄▄█▀██ ██ ▄▄█▀██▀███▄███▀███ ▄██▀██▄▀███ ▀███ ▄██▀███" + CEND) time.sleep(0.7) print(CRED + " ██ ██ ██ ██ ▄█▀ ██ ██ ▄█▀ ██ ██▀ ▀▀ ██ ██▀ ▀██ ██ ██ ██ ▀▀" + CEND) time.sleep(0.7) print(CPURPLE + " ██ ▄██ ██ ██ ██▀▀▀▀▀▀ ██ ██▀▀▀▀▀▀ ██ ██ ██ ██ ██ ██ ▀█████▄" + CEND) time.sleep(0.7) print(CBLUE + " ██ ▄██▀ ██ ██ ██▄ ▄ ██ ██▄ ▄ ██ ██ ██▄ ▄██ ██ ██ █▄ ██" + CEND) time.sleep(0.7) print(CBLUE + " ▄████████▀ ▀████▀███▄ ▀█████▀▄████▄ ▀█████▀████▄ ▄████▄ ▀█████▀ ▀████▀███▄██████▀" + CEND) typing_effect1("© Duelerious Entertainment Systems Inc. 1983") print() def stamped_logo(): print(CGREEN + "▀███▀▀▀██▄ ▀███ ██ " + CEND) print(CYELLOW + " ██ ▀██▄ ██ " + CEND) print(CORANGE + " ██ ▀█████ ▀███ ▄▄█▀██ ██ ▄▄█▀██▀███▄███▀███ ▄██▀██▄▀███ ▀███ ▄██▀███" + CEND) print(CRED + " ██ ██ ██ ██ ▄█▀ ██ ██ ▄█▀ ██ ██▀ ▀▀ ██ ██▀ ▀██ ██ ██ ██ ▀▀" + CEND) print(CPURPLE + " ██ ▄██ ██ ██ ██▀▀▀▀▀▀ ██ ██▀▀▀▀▀▀ ██ ██ ██ ██ ██ ██ ▀█████▄" + CEND) print(CBLUE + " ██ ▄██▀ ██ ██ ██▄ ▄ ██ ██▄ ▄ ██ ██ ██▄ ▄██ ██ ██ █▄ ██" + CEND) print(CBLUE + " ▄████████▀ ▀████▀███▄ ▀█████▀▄████▄ ▀█████▀████▄ ▄████▄ ▀█████▀ ▀████▀███▄██████▀" + CEND) typing_effect2("© Duelerious Entertainment Systems Inc. 1983") print() start()