main
Jan-Niclas Loosen 12 months ago
parent cfc94f34d9
commit 766c51f954

@ -5,10 +5,8 @@
</component>
<component name="ChangeListManager">
<list default="true" id="c8162e9c-0010-43df-bfbc-c294a3a64a5d" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/UNI_Python.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/UNI_Python.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ha_05/loosen_janniclas_1540907_06.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ha_02/loosen_janniclas_1540907_03.py" beforeDir="false" afterPath="$PROJECT_DIR$/ha_02/loosen_janniclas_1540907_03.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -44,7 +42,7 @@
<recent name="C:\Universitaet\UNI_Python\ha_04" />
</key>
</component>
<component name="RunManager" selected="Python.loosen_janniclas_1540907_03">
<component name="RunManager" selected="Python.loosen_janniclas_1540907_06">
<configuration name="loosen_janniclas_1540907_03" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="UNI_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -89,8 +87,31 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="loosen_janniclas_1540907_06" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="UNI_Python" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ha_05" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/ha_05/loosen_janniclas_1540907_06.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.loosen_janniclas_1540907_06" />
<item itemvalue="Python.loosen_janniclas_1540907_03" />
<item itemvalue="Python.loosen_janniclas_1540907_05" />
</list>
@ -108,6 +129,7 @@
<workItem from="1701163646587" duration="660000" />
<workItem from="1701177311506" duration="2378000" />
<workItem from="1701179783052" duration="66000" />
<workItem from="1701623797251" duration="4657000" />
</task>
<servers />
</component>
@ -117,5 +139,6 @@
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/UNI_Python$loosen_janniclas_1540907_05.coverage" NAME="loosen_janniclas_1540907_05 Coverage Results" MODIFIED="1701179684140" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/ha_04" />
<SUITE FILE_PATH="coverage/UNI_Python$loosen_janniclas_1540907_03.coverage" NAME="loosen_janniclas_1540907_03 Coverage Results" MODIFIED="1701179808579" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/ha_02" />
<SUITE FILE_PATH="coverage/UNI_Python$loosen_janniclas_1540907_06.coverage" NAME="loosen_janniclas_1540907_06 Coverage Results" MODIFIED="1701628625468" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/ha_05" />
</component>
</project>

@ -0,0 +1,100 @@
import random
class CeaserChiffre:
chiffre = {}
def __init__(self, chiffre=None):
if chiffre is not None:
self.chiffre = chiffre
else:
self._create_chiffre()
def __str__(self):
return str(self.chiffre)
def _create_chiffre(self):
codes = {}
chars = list(range(0, 255))
for char in range(0, 255):
rand = random.choice(chars)
chars.remove(rand)
codes[chr(char)] = chr(rand)
self.chiffre = codes
def encode(self, text):
return self._work(text, self.chiffre)
def decode(self, text):
chiffre = {value: key for key, value in self.chiffre.items()}
return self._work(text, chiffre)
def _work(self, text, chiffre):
result = []
for i in range(len(text)):
if text[i] in chiffre:
result.append(chiffre[text[i]])
else:
result.append(text[i])
return ''.join(result)
class Game:
scores = {"player": 0, "bot": 0}
choices = {}
mode = "easy"
def __init__(self, rules, mode="easy"):
self.rules = rules
self.choices = {key: 0 for key in self.rules}
self.mode = mode
def reset(self):
self.scores["player"] = 0
self.scores["player"] = 0
def play(self, players_choice):
if players_choice not in self.rules:
raise ValueError("Invalid choice. Please choose from: " + ', '.join(self.rules.keys()))
def _god(self, players_choice):
for choice in self.rules:
def _easy(self, choice):
def _hard(self, choice):
text = '''
Liebe/r Empfänger,
Herzliche Grüße aus dem hohen Norden! Ich hoffe, diese Nachricht erreicht dich in guter Verfassung und fügt einen Hauch
von festlicher Stimmung zu deinem Tag hinzu.
Ich wünsche dir Freude, Gelächter und einen festlichen Geist, der dein Herz erwärmt. Genieße die Magie der Feiertage!
Herzliche Grüße,
Rudolph
'''
# ceaser = CeaserChiffre()
# print(ceaser.decode(ceaser.encode(text)))
rock_paper_scissor = {
"rock": {"rock": 0, "paper": -1, "scissor": 1},
"paper": {"rock": 1, "paper": 0, "scissor": -1},
"scissor": {"rock": -1, "paper": 1, "scissor": 0}
}
rock_paper_scissor_lizard_spock = {
"rock": {"rock": 0, "paper": -1, "scissor": 1, "lizard": 1, "spock": -1},
"paper": {"rock": 1, "paper": 0, "scissor": -1, "lizard": -1, "spock": 1},
"scissor": {"rock": -1, "paper": 1, "scissor": 0, "lizard": 1, "spock": -1},
"lizard": {"rock": -1, "paper": 1, "scissor": -1, "lizard": 0, "spock": 1},
"spock": {"rock": 1, "paper": -1, "scissor": 1, "lizard": -1, "spock": 0}
}
game = Game(rock_paper_scissor)
print(game.choices)
Loading…
Cancel
Save