File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1919 uv run ruff check brain_games/scripts/brain_even.py
2020 uv run ruff check brain_games/scripts/brain_calc.py
2121 uv run ruff check brain_games/scripts/brain_gcd.py
22+ uv run ruff check brain_games/scripts/brain_progression.py
2223 uv run ruff check brain_games/games/even.py
2324 uv run ruff check brain_games/games/calc.py
2425 uv run ruff check brain_games/games/gcd.py
26+ uv run ruff check brain_games/games/progression.py
2527 uv run ruff check brain_games/utils.py
2628 uv run ruff check brain_games/engine.py
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ def get_right_answer(expression: str) -> str:
2727
2828
2929def get_msg_game_rules () -> str :
30- return "Find the greatest common divisor of given numbers."
30+ return "Find the greatest common divisor of given numbers."
Original file line number Diff line number Diff line change 1+ import random
2+
3+ from brain_games .utils import ask_answer
4+
5+ hidden_number : str
6+
7+
8+ def get_answer_and_right_answer (expression : str ) -> tuple :
9+ answer = ask_answer ()
10+ right_answer = get_right_answer (expression )
11+ return (answer , right_answer )
12+
13+
14+ def get_question_msg () -> str :
15+ length = random .randint (5 , 10 )
16+ position = random .randint (0 , length - 1 )
17+ start_num = random .randint (0 , 10 )
18+ step = random .randint (1 , 10 )
19+ stop_num = start_num + step * (length - 1 )
20+ progression_lst = [str (num ) for num in range (start_num , stop_num , step )]
21+ global hidden_number
22+ hidden_number = progression_lst [position ]
23+ progression_lst [position ] = '..'
24+ return ' ' .join (progression_lst )
25+
26+
27+ def get_right_answer (expression : str ) -> str :
28+ return hidden_number
29+
30+
31+ def get_msg_game_rules () -> str :
32+ return "What number is missing in the progression?"
Original file line number Diff line number Diff line change 1+ from brain_games import engine
2+ from brain_games .games import progression
3+
4+
5+ def main () -> None :
6+ engine .engine_run (progression )
7+
8+
9+ if __name__ == '__main__' :
10+ main ()
Original file line number Diff line number Diff line change @@ -25,3 +25,4 @@ brain-games = "brain_games.scripts.brain_games:main"
2525brain-even = " brain_games.scripts.brain_even:main"
2626brain-calc = " brain_games.scripts.brain_calc:main"
2727brain-gcd = " brain_games.scripts.brain_gcd:main"
28+ brain-progression = " brain_games.scripts.brain_progression:main"
You can’t perform that action at this time.
0 commit comments