diff --git a/Game/game.ipynb b/Game/game.ipynb deleted file mode 100644 index 4a09547..0000000 --- a/Game/game.ipynb +++ /dev/null @@ -1,234 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "c74a7a8e-6e0a-4f42-a18f-46b1aa7fddb1", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (1x)\n", - "\n", - "Du hast 5.5 Coins (+ 0.5)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (2x)\n", - "\n", - "Du hast 6.5 Coins (+ 1.0)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (3x)\n", - "\n", - "Du hast 8.0 Coins (+ 1.5)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Zahl\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Zahl\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (1x)\n", - "\n", - "Du hast 8.5 Coins (+ 0.5)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Zahl\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (1x)\n", - "\n", - "Du hast 9.0 Coins (+ 0.5)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (2x)\n", - "\n", - "Du hast 10.0 Coins (+ 1.0)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Kopf (3x)\n", - "\n", - "Du hast 11.5 Coins (+ 1.5)\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Zahl\n" - ] - } - ], - "source": [ - "#import menu\n", - "import random\n", - "\n", - "propability = 40\n", - "coins_per_head = 0.5\n", - "coins = 5\n", - "coins_amount = 1\n", - "multiplier = 0.5\n", - "\n", - "def coin_flip(propability, coins, coins_per_head, coins_amount, multiplier):\n", - " while True:\n", - " result = random.randint(0, 100)\n", - " if result in range(0,propability):\n", - " print(f'Kopf ({coins_amount}x)') \n", - " coins_amount += 1 #Anzahl an hintereinander geworfenen \"Köpfen\"\n", - " if coins_amount >=3:\n", - " coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander\n", - " else:\n", - " coins_per_head = 0.5\n", - " coins += coins_per_head\n", - " print('')\n", - " print(f'Du hast {coins} Coins (+ {coins_per_head})')\n", - " input()\n", - " elif result in range(propability,100):\n", - " print('Zahl')\n", - " coins_amount = 1\n", - " input()\n", - "\n", - "\n", - "coin_flip(propability, coins, coins_per_head, coins_amount, multiplier)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e0acbe2a-a8d1-4928-8e49-dd39a75d2b83", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.12" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/Game/game.py b/Game/game.py index 138325a..e30e969 100644 --- a/Game/game.py +++ b/Game/game.py @@ -4,19 +4,27 @@ import random propability = 40 coins_per_head = 0.5 coins = 5 +coins_amount = 1 +multiplier = 0.5 -def coin_flip(propability, coins, coins_per_head): +def coin_flip(propability, coins, coins_per_head, coins_amount, multiplier): while True: result = random.randint(0, 100) if result in range(0,propability): - print(*'Kopf') + print(f'Kopf ({coins_amount}x)') + coins_amount += 1 #Anzahl an hintereinander geworfenen "Köpfen" + if coins_amount >=3: + coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander + else: + coins_per_head = 0.5 coins += coins_per_head print('') - print(f'Du hast {coins} coins') + print(f'Du hast {coins} Coins (+ {coins_per_head})') input() elif result in range(propability,100): print('Zahl') + coins_amount = 1 input() -coin_flip(propability, coins, coins_per_head) +coin_flip(propability, coins, coins_per_head, coins_amount, multiplier) diff --git a/Game/menu.ipynb b/Game/menu.ipynb deleted file mode 100644 index bb9793e..0000000 --- a/Game/menu.ipynb +++ /dev/null @@ -1,162 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 29, - "id": "bff3a30a-d5dc-493d-94fd-886ea464a554", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Herzlich Willkommen zu\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Druecke eine beliebige Taste \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "M U E N Z E N W E R F E R\n", - "\n", - "Druecke [1] um ein Spiel zu starten und [2] um das Spiel zu beenden\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nun Gut!\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Du weisst, wie man spielt, oder?\n", - "\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Lies nochmal die README.txt und druecke [Enter], wenn du fertig bist\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - " \n" - ] - } - ], - "source": [ - "import sys \n", - "def title_screen():\n", - " print('Herzlich Willkommen zu')\n", - " input('Druecke eine beliebige Taste')\n", - " print(*'MUENZENWERFER')\n", - " print('')\n", - "\n", - "def end_game_or_start_question():\n", - " while True:\n", - " print('Druecke [1] um ein Spiel zu starten und [2] um das Spiel zu beenden')\n", - " a = input()\n", - " try:\n", - " a = int(a)\n", - " if a in (1, 2):\n", - " break\n", - " else:\n", - " print('1 oder 2!')\n", - " except ValueError:\n", - " print('Du sollst nur Zahlen eingeben')\n", - " \n", - " return a\n", - "\n", - "def menu_navigation(a):\n", - " if a == 1:\n", - " print('Nun Gut!')\n", - " input('')\n", - " print('Du weisst, wie man spielt, oder?')\n", - " print('')\n", - " playknowledge = input('')\n", - " if playknowledge in ('Ja', 'ja'):\n", - " print('Super!')\n", - " print('')\n", - " print('Dann kann es ja losgehen')\n", - " else:\n", - " print('Nein? Dann lies nochmal die README.txt und druecke [Enter], wenn du fertig bist')\n", - " input('')\n", - " elif a == 2:\n", - " print('Schade, es gibt kein Zurueck mehr jetzt')\n", - " input()\n", - " sys.exit()\n", - " \n", - "title_screen()\n", - "a = end_game_or_start_question()\n", - "menu_navigation(a)\n", - " \n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "261c5908-bfdd-45d3-bef4-97030bd28e85", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.12" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/Game/menu.py b/Game/menu.py index 6e7a363..f04b897 100644 --- a/Game/menu.py +++ b/Game/menu.py @@ -11,10 +11,13 @@ def end_game_or_start_question(): a = input() try: a = int(a) - if a == int(a): + if a in (1, 2): break + else: + print('1 oder 2!') except ValueError: print('Du sollst nur Zahlen eingeben') + return a def menu_navigation(a): @@ -24,12 +27,12 @@ def menu_navigation(a): print('Du weisst, wie man spielt, oder?') print('') playknowledge = input('') - if playknowledge == 'Ja': + if playknowledge in ('Ja', 'ja'): print('Super!') print('') print('Dann kann es ja losgehen') else: - print('Lies nochmal die README.txt und druecke [Enter], wenn du fertig bist') + print('Nein? Dann lies nochmal die README.txt und druecke [Enter], wenn du fertig bist') input('') elif a == 2: print('Schade, es gibt kein Zurueck mehr jetzt')