Überarbeitung des Codes (Optimierung) und kleine Features Hinzugefügt (Multiplikator + Counter)
163 lines
3.6 KiB
Plaintext
163 lines
3.6 KiB
Plaintext
{
|
|
"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
|
|
}
|