File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1818 uv run ruff check brain_games/scripts/brain_games.py
1919 uv run ruff check brain_games/scripts/brain_even.py
2020 uv run ruff check brain_games/scripts/brain_calc.py
21+ uv run ruff check brain_games/scripts/brain_gcd.py
2122 uv run ruff check brain_games/games/even.py
2223 uv run ruff check brain_games/games/calc.py
24+ uv run ruff check brain_games/games/gcd.py
2325 uv run ruff check brain_games/utils.py
2426 uv run ruff check brain_games/engine.py
Original file line number Diff line number Diff line change 1+ import random
2+
3+ from brain_games .utils import ask_answer
4+
5+
6+ def get_answer_and_right_answer (expression : str ) -> tuple :
7+ answer = ask_answer ()
8+ right_answer = get_right_answer (expression )
9+ return (answer , right_answer )
10+
11+
12+ def get_question_msg () -> str :
13+ left_num = random .randint (0 , 100 )
14+ right_num = random .randint (0 , 100 )
15+ return f"{ left_num } { right_num } "
16+
17+
18+ def get_right_answer (expression : str ) -> str :
19+ left_num , right_num = expression .split ()
20+ left_num = int (left_num )
21+ right_num = int (right_num )
22+ while right_num != 0 :
23+ mod = left_num % right_num
24+ left_num = right_num
25+ right_num = mod
26+ return str (left_num )
27+
28+
29+ def get_msg_game_rules () -> str :
30+ return "Find the greatest common divisor of given numbers."
Original file line number Diff line number Diff line change 1+ from brain_games import engine
2+ from brain_games .games import gcd
3+
4+
5+ def main () -> None :
6+ engine .engine_run (gcd )
7+
8+
9+ if __name__ == '__main__' :
10+ main ()
Original file line number Diff line number Diff line change @@ -24,3 +24,4 @@ dev = [
2424brain-games = " brain_games.scripts.brain_games:main"
2525brain-even = " brain_games.scripts.brain_even:main"
2626brain-calc = " brain_games.scripts.brain_calc:main"
27+ brain-gcd = " brain_games.scripts.brain_gcd:main"
You can’t perform that action at this time.
0 commit comments