Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac086fc379 | |||
| e1a1f9f61b | |||
| 1301f196bf | |||
| f40a1799ee | |||
| 088e7e695b |
234
Game/game.ipynb
234
Game/game.ipynb
@@ -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
|
|
||||||
}
|
|
||||||
16
Game/game.py
16
Game/game.py
@@ -4,19 +4,27 @@ import random
|
|||||||
propability = 40
|
propability = 40
|
||||||
coins_per_head = 0.5
|
coins_per_head = 0.5
|
||||||
coins = 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:
|
while True:
|
||||||
result = random.randint(0, 100)
|
result = random.randint(0, 100)
|
||||||
if result in range(0,propability):
|
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
|
coins += coins_per_head
|
||||||
print('')
|
print('')
|
||||||
print(f'Du hast {coins} coins')
|
print(f'Du hast {coins} Coins (+ {coins_per_head})')
|
||||||
input()
|
input()
|
||||||
elif result in range(propability,100):
|
elif result in range(propability,100):
|
||||||
print('Zahl')
|
print('Zahl')
|
||||||
|
coins_amount = 1
|
||||||
input()
|
input()
|
||||||
|
|
||||||
|
|
||||||
coin_flip(propability, coins, coins_per_head)
|
coin_flip(propability, coins, coins_per_head, coins_amount, multiplier)
|
||||||
|
|||||||
162
Game/menu.ipynb
162
Game/menu.ipynb
@@ -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
|
|
||||||
}
|
|
||||||
@@ -11,10 +11,13 @@ def end_game_or_start_question():
|
|||||||
a = input()
|
a = input()
|
||||||
try:
|
try:
|
||||||
a = int(a)
|
a = int(a)
|
||||||
if a == int(a):
|
if a in (1, 2):
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
print('1 oder 2!')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print('Du sollst nur Zahlen eingeben')
|
print('Du sollst nur Zahlen eingeben')
|
||||||
|
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def menu_navigation(a):
|
def menu_navigation(a):
|
||||||
@@ -24,12 +27,12 @@ def menu_navigation(a):
|
|||||||
print('Du weisst, wie man spielt, oder?')
|
print('Du weisst, wie man spielt, oder?')
|
||||||
print('')
|
print('')
|
||||||
playknowledge = input('')
|
playknowledge = input('')
|
||||||
if playknowledge == 'Ja':
|
if playknowledge in ('Ja', 'ja'):
|
||||||
print('Super!')
|
print('Super!')
|
||||||
print('')
|
print('')
|
||||||
print('Dann kann es ja losgehen')
|
print('Dann kann es ja losgehen')
|
||||||
else:
|
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('')
|
input('')
|
||||||
elif a == 2:
|
elif a == 2:
|
||||||
print('Schade, es gibt kein Zurueck mehr jetzt')
|
print('Schade, es gibt kein Zurueck mehr jetzt')
|
||||||
|
|||||||
14
Game/upgrades.py
Normal file
14
Game/upgrades.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class upgrades:
|
||||||
|
def __init__(self, name, cost, level):
|
||||||
|
self.name = name
|
||||||
|
self.cost = cost
|
||||||
|
self.level = level
|
||||||
|
|
||||||
|
def buy(self, coins):
|
||||||
|
if coins >= self.cost:
|
||||||
|
coins -= self.cost
|
||||||
|
self.level += 1
|
||||||
|
print(f"{self.name} wurde auf Level {self.level} verbessert")
|
||||||
|
else:
|
||||||
|
print("Nicht genug Coins!")
|
||||||
|
|
||||||
Reference in New Issue
Block a user