From cc7125719f02693f8450cc19c5ff097dabddc4c7 Mon Sep 17 00:00:00 2001 From: VictorVangeli Date: Tue, 8 Oct 2024 09:33:23 +0300 Subject: [PATCH] move and update 'engine.py' --- brain_games/{games => }/engine.py | 10 +++++----- .../games/__pycache__/engine.cpython-310.pyc | Bin 1336 -> 0 bytes brain_games/games/calc.py | 2 +- brain_games/games/even.py | 2 +- brain_games/games/gcd.py | 2 +- brain_games/games/prime.py | 2 +- brain_games/games/progression.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) rename brain_games/{games => }/engine.py (75%) delete mode 100644 brain_games/games/__pycache__/engine.cpython-310.pyc diff --git a/brain_games/games/engine.py b/brain_games/engine.py similarity index 75% rename from brain_games/games/engine.py rename to brain_games/engine.py index 1119d42..4e25257 100644 --- a/brain_games/games/engine.py +++ b/brain_games/engine.py @@ -1,13 +1,14 @@ from brain_games.const import ENTER_NAME, GREETING_MESSAGE, ROUNDS_NUMBERS -def play_game(game_round, game_rules: str): +def play_game(get_question_and_answer, game_rules: str): """ The logic of the game, which repeats the questions until the user answers correctly several times in a row Args: - game_round (Callable): A function that describes one round of the game. + get_question_and_answer (Callable): A function that describes one round + of the game. game_rules (str): The rules of the game that will be displayed before the start """ @@ -17,7 +18,7 @@ def play_game(game_round, game_rules: str): print(game_rules) for _ in range(ROUNDS_NUMBERS): - question, correct_answer = game_round() + question, correct_answer = get_question_and_answer() print(f"Question: {question}") answer = input("Your answer: ").strip().lower() @@ -27,8 +28,7 @@ def play_game(game_round, game_rules: str): print( f'"{answer}" is wrong answer ;(. ' f'Correct answer was "{correct_answer}".' - ) - print(f"Let's try again, {username}!") + f'Let\'s try again, {username}!') return print(f"Congratulations, {username}!") diff --git a/brain_games/games/__pycache__/engine.cpython-310.pyc b/brain_games/games/__pycache__/engine.cpython-310.pyc deleted file mode 100644 index 5de5ea966008f7f6ae6ed79a495c93acd21db137..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1336 zcmZ`&O=}x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