From ca5f1b4e499e2e0a3d16e228a65b27350feaca1f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 Jul 2025 16:04:21 +0200 Subject: initial commit --- hangman.py | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ rock_paper_scissors.py | 42 +++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100755 hangman.py create mode 100755 rock_paper_scissors.py diff --git a/hangman.py b/hangman.py new file mode 100755 index 0000000..7eb7fff --- /dev/null +++ b/hangman.py @@ -0,0 +1,91 @@ +# ___ ___ ____ +# / | \ _____ ____ / ___\ _____ _____ ____ +#/ ~ \\__ \ / \ / /_/ >/ \ \__ \ / \ +#\ Y / / __ \_| | \ \___ /| Y Y \ / __ \_| | \ +# \___|_ / (____ /|___| //_____/ |__|_| /(____ /|___| / +# \/ \/ \/ \/ \/ \/ + +import random + +# Liste von Schimpfwörter +schimpfwörter = ["Arschkröte", "Arschloch", "Hurensohn", "Arschkriecher", "Muttersöhnchen", + "Pimmelflöte", "Steckdosenbefruchter", "Analgeneral", "Evolutionsbremse", "Hodenkobold", + "Dönergesicht", "Arschgeburt", "Fickschlitz", "Vollpfosten", "Hanswurst", + "Stinkmorchel", "Pupskopf", "Mistmade", "Dünnbrettbohrer", "Intelligenzverweigerer", + "Affenarsch", "Käsekopf", "Schwanzlutscher", "Wadenbeisser", "Verbalerotiker", + "Intelligenzallergiker", "Arschkrampe", "Klotaucher", "Popelnascher", "Nichtabschreiblasser", + "Sitzpinkler", "Allmannshure", "Arschgucker", "Hannsdumm", "Pantoffelritter", + "Halunke", "Gewitterziege", "Taugenichts", "Spargeltarzan", "Klugscheisser", + "Sackgesicht", "Klorandlutscher", "Sockenraucher", "Pornoprinzessin", "Fotzenfurz", + "Dünnschissgurgler", "Schwingtitte", "Perückenschaf"] + +# Zufällige Auswahl eines Schimpfwortes aus der Liste +random_schimpfwort = random.choice(schimpfwörter) + +# Auswahlmenü +while True: + user_answer = input('Möchten Sie ein zufälliges Schimpfwort nehmen oder dein eigenes Wort erstellen für das Spiel? [1/2] > ') + if user_answer == '1': + word = random_schimpfwort + break + elif user_answer == '2': + word = input('Geben Sie Ihr Wort hier ein > ') + print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n') + break + else: + print('Ungültige Eingabe! Sie dürfen nur zwischen 1 & 2 wählen.\n ') + continue + +word_list = list(word.upper()) +hidden_word = list('_' * len(word)) +errors = 10 + +while hidden_word != word_list: + print("\n") + print(*hidden_word) + print("\n") + user_choice = input("Wähle einen Buchstaben: ").upper() + + if user_choice not in word_list: + errors = errors - 1 + if errors == 9: + print(" \n \n \n___") + elif errors == 8: + print(" \n \n \n_|_") + elif errors == 7: + print(" \n \n |\n_|_") + elif errors == 6: + print(" \n |\n |\n_|_") + elif errors == 5: + print(" ___\n |\n |\n_|_") + elif errors == 4: + print(" ___\n | O\n |\n_|_") + elif errors == 3: + print(" ___\n | _O\n |\n_|_") + elif errors == 2: + print(" ___\n | _O_\n |\n_|_") + elif errors == 1: + print(" ___\n | _O_\n | /\n_|_") + elif errors == 0: + print("du bist tot!\n ___\n | _O_\n | /\\\n_|_") + if word == random_schimpfwort: + print("Du =", *word_list) + quit() + else: + print("Wort =", *word_list) + quit() + print("\nDu hast noch", errors, "Fehler.") + + else: + i = 0 + while i < len(word_list): + if word_list[i] == user_choice: + hidden_word[i] = user_choice + i = i + 1 + else: + i = i + 1 + + print("Glückwunsch! Der Buchstabe passt!") + +print("\n", *word_list, "\n") +print("Glückwunsch! Du hast das Geheimwort erraten!") \ No newline at end of file diff --git a/rock_paper_scissors.py b/rock_paper_scissors.py new file mode 100755 index 0000000..cbabb97 --- /dev/null +++ b/rock_paper_scissors.py @@ -0,0 +1,42 @@ +import random + +user_wins = 0 +computer_wins = 0 + +options = ["rock", "paper", "scissors"] + +while True: + user_input = input("Type Rock/Paper/Scissors or Q to quit: ").lower() + if user_input == "q": + break + + if user_input not in options: + continue + + random_number = random.randint(0, 2) + # rock: 0, paper: 1, scissors: 2 + computer_pick = options[random_number] + print("Computer picked", computer_pick + ".") + + if user_input == "rock" and computer_pick == "scissors": + print("You won!") + user_wins = user_wins + 1 + + elif user_input == "scissors" and computer_pick == "paper": + print("You won!") + user_wins = user_wins + 1 + + elif user_input == "paper" and computer_pick == "rock": + print("You won!") + user_wins = user_wins + 1 + + elif user_input == computer_pick: + print("DRAW") + + else: + print("You lost!") + computer_wins = computer_wins + 1 + +print("You won", user_wins, "times.") +print("The computer won", computer_wins, "times.") +print("Goodbye!") \ No newline at end of file -- cgit v1.2.3