1
0
Fork 0

remove doc linebreaks

This commit is contained in:
Lili (Tlapka) 2021-03-30 13:42:44 +02:00
parent ce9f335da5
commit 04e79c27d2
2 changed files with 0 additions and 13 deletions

View File

@ -87,13 +87,11 @@ class Game:
def next_level_exists(self): def next_level_exists(self):
"""Return true if next level exists.""" """Return true if next level exists."""
next_level = "level" + str(self.level + 1) next_level = "level" + str(self.level + 1)
return next_level in self.level_mapping return next_level in self.level_mapping
def next_level_is_forked(self): def next_level_is_forked(self):
"""Return true if next level is forked.""" """Return true if next level is forked."""
next_level = "level" + str(self.level + 1) next_level = "level" + str(self.level + 1)
if next_level in self.level_mapping: if next_level in self.level_mapping:
if len(self.level_mapping[next_level]) > 1: if len(self.level_mapping[next_level]) > 1:

View File

@ -10,7 +10,6 @@ import time
def print_help(): def print_help():
"""Print list of arguments that game_loop accepts.""" """Print list of arguments that game_loop accepts."""
print("Functions that control the game:") print("Functions that control the game:")
print("(A)bort - destroys all VMs, resets progress to level 0.") print("(A)bort - destroys all VMs, resets progress to level 0.")
print("(E)xit - aborts run, then exits the assistant.") print("(E)xit - aborts run, then exits the assistant.")
@ -29,7 +28,6 @@ def check_prerequisites():
"""Check for the right version of required tools and print the result. """Check for the right version of required tools and print the result.
VirtualBox check fails on windows even when VirtualBox is present.""" VirtualBox check fails on windows even when VirtualBox is present."""
print("checking Python version:") print("checking Python version:")
found = True found = True
try: try:
@ -84,7 +82,6 @@ def check_prerequisites():
def write_log(filename, game, hint_giver): def write_log(filename, game, hint_giver):
"""Write log from `game` and `hint_giver` to file `filename` """Write log from `game` and `hint_giver` to file `filename`
Calls logging methods, which are just yaml dumps.""" Calls logging methods, which are just yaml dumps."""
try: try:
game.log_to_file(filename) game.log_to_file(filename)
@ -96,7 +93,6 @@ def write_log(filename, game, hint_giver):
def give_hint(game, hint_giver): def give_hint(game, hint_giver):
"""Recap previously given hints, and give player another hint if they want.""" """Recap previously given hints, and give player another hint if they want."""
if not game.game_in_progress: if not game.game_in_progress:
print("Game not started, can't give hints.") print("Game not started, can't give hints.")
return return
@ -126,7 +122,6 @@ def give_hint(game, hint_giver):
def starting_quiz(level_selector): def starting_quiz(level_selector):
"""Ask the player a few questions, saving known tools to level selector.""" """Ask the player a few questions, saving known tools to level selector."""
print("Please answer 'yes' if you have ever used a tool or skill before,") print("Please answer 'yes' if you have ever used a tool or skill before,")
print("or 'no' if you haven't.") print("or 'no' if you haven't.")
for tool in level_selector.tool_list: for tool in level_selector.tool_list:
@ -149,7 +144,6 @@ def starting_quiz(level_selector):
def start_game(game, level_selector): def start_game(game, level_selector):
"""Start the game through the game object after doing a starting quiz.""" """Start the game through the game object after doing a starting quiz."""
print("Before the game starts, please fill in a little quiz.") print("Before the game starts, please fill in a little quiz.")
print("It will help better decide what levels you will play.") print("It will help better decide what levels you will play.")
confirmation = starting_quiz(level_selector) confirmation = starting_quiz(level_selector)
@ -169,7 +163,6 @@ def start_game(game, level_selector):
def abort_game(game, hint_giver): def abort_game(game, hint_giver):
"""Abort the game and reset all progress, log current game in a file.""" """Abort the game and reset all progress, log current game in a file."""
try: try:
if os.path.isdir("logs"): if os.path.isdir("logs"):
write_log("logs/aborted_game" + str(time.time()), game, hint_giver) write_log("logs/aborted_game" + str(time.time()), game, hint_giver)
@ -184,7 +177,6 @@ def abort_game(game, hint_giver):
def player_logging(game, hint_giver): def player_logging(game, hint_giver):
"""Player-initiated log of the game. Always saves to logs/game_log.yml""" """Player-initiated log of the game. Always saves to logs/game_log.yml"""
if os.path.exists("logs/game_log.yml"): if os.path.exists("logs/game_log.yml"):
print("It appears that there is already a saved game log.") print("It appears that there is already a saved game log.")
print("Write 'yes' to overwrite it.") print("Write 'yes' to overwrite it.")
@ -203,7 +195,6 @@ def player_logging(game, hint_giver):
def finish_game(game): def finish_game(game):
"""Mark game as finished, inform player if that's impossible.""" """Mark game as finished, inform player if that's impossible."""
if game.finish_game(): if game.finish_game():
print("Game finished, total time saved!") print("Game finished, total time saved!")
elif (not game.game_in_progress and not game.game_finished): elif (not game.game_in_progress and not game.game_finished):
@ -233,9 +224,7 @@ def game_loop():
Helper functions: Helper functions:
(H)elp - explains all commands on the screen. (H)elp - explains all commands on the screen.
(C)heck - checks if prerequisites to run the game are installed. (C)heck - checks if prerequisites to run the game are installed.
""" """
if not os.path.isdir("logs"): if not os.path.isdir("logs"):
try: try:
os.mkdir("logs") os.mkdir("logs")