File tree Expand file tree Collapse file tree 7 files changed +22
-36
lines changed Expand file tree Collapse file tree 7 files changed +22
-36
lines changed Original file line number Diff line number Diff line change 1- GREETING = [
2- 'Welcome to the Brain Games!\n '
3- 'May I have your name? '
4- ]
5- EVEN_GAME_INTRODUCTION = [
6- 'Answer "yes" if the number is even, otherwise answer "no".'
7- ]
8- CALC_GAME_INTRODUCTION = [
9- 'What is the result of the expression?'
10- ]
11- GCD_GAME_INTRODUCTION = [
12- 'Find the greatest common divisor of given numbers.'
13- ]
14- PROG_GAME_INTRODUCTION = [
15- 'What number is missing in the progression?'
16- ]
17- PRIME_GAME_INTRODUCTION = [
18- 'Answer "yes" if given number is prime. Otherwise answer "no".'
19- ]
1+ GREETING = 'Welcome to the Brain Games!\n ' 'May I have your name?'
2+ EVEN_GAME_BRIEFING = 'Answer "yes" if the number is even, otherwise answer "no".'
3+ CALC_GAME_BRIEFING = 'What is the result of the expression?'
4+ GCD_GAME_BRIEFING = 'Find the greatest common divisor of given numbers.'
5+ PROG_GAME_BRIEFING = 'What number is missing in the progression?'
6+ PRIME_GAME_BRIEFING = 'Answer "yes" if given number is prime. Otherwise answer "no".'
207
21- GAMES_TO_WIN = 3
8+ NUMBER_OF_GAMES = 3
229MATH_SYMBOLS = ['+' , '-' , '*' ]
23- STEP_OF_SEQUENCE = [2 , 3 , 4 , 5 ]
Original file line number Diff line number Diff line change 22import brain_games .constants as const
33
44
5- def game_engine (get_question_and_answer , introduction ):
6- username = prompt .string ('' . join ( const .GREETING ) )
5+ def game_engine (get_question_and_answer , briefing ):
6+ username = prompt .string (const .GREETING )
77 print (f'Hello, { username } !' )
8- print ('' . join ( introduction ) )
9- for _ in range (const .GAMES_TO_WIN ):
8+ print (briefing )
9+ for _ in range (const .NUMBER_OF_GAMES ):
1010 question , answer = get_question_and_answer ()
1111 print (f'Question: { question } ' )
1212 user_answer = prompt .string ('Your answer: ' )
Original file line number Diff line number Diff line change 11import random
22from brain_games .game_engine import game_engine
33from brain_games .constants import MATH_SYMBOLS
4- from brain_games .constants import CALC_GAME_INTRODUCTION
4+ from brain_games .constants import CALC_GAME_BRIEFING
55
66
77def get_expression_and_answer ():
@@ -13,4 +13,4 @@ def get_expression_and_answer():
1313
1414
1515def calc_game ():
16- game_engine (get_expression_and_answer , CALC_GAME_INTRODUCTION )
16+ game_engine (get_expression_and_answer , CALC_GAME_BRIEFING )
Original file line number Diff line number Diff line change 11import random
22from brain_games .game_engine import game_engine
3- from brain_games .constants import EVEN_GAME_INTRODUCTION
3+ from brain_games .constants import EVEN_GAME_BRIEFING
44
55
66def is_even (number ):
@@ -16,4 +16,4 @@ def get_random_num_and_answer():
1616
1717
1818def even_game ():
19- game_engine (get_random_num_and_answer , EVEN_GAME_INTRODUCTION )
19+ game_engine (get_random_num_and_answer , EVEN_GAME_BRIEFING )
Original file line number Diff line number Diff line change 11import random
22
33from brain_games .game_engine import game_engine
4- from brain_games .constants import GCD_GAME_INTRODUCTION
4+ from brain_games .constants import GCD_GAME_BRIEFING
55
66
77def get_greatest_common_divisor (num1 , num2 ):
@@ -18,4 +18,4 @@ def get_random_numbers_and_answer():
1818
1919
2020def gcd_game ():
21- game_engine (get_random_numbers_and_answer , GCD_GAME_INTRODUCTION )
21+ game_engine (get_random_numbers_and_answer , GCD_GAME_BRIEFING )
Original file line number Diff line number Diff line change 11import random
22
33from brain_games .game_engine import game_engine
4- from brain_games .constants import PRIME_GAME_INTRODUCTION
4+ from brain_games .constants import PRIME_GAME_BRIEFING
55
66
77def is_prime (number ):
@@ -19,4 +19,4 @@ def get_random_number_and_answer():
1919
2020
2121def prime_game ():
22- game_engine (get_random_number_and_answer , PRIME_GAME_INTRODUCTION )
22+ game_engine (get_random_number_and_answer , PRIME_GAME_BRIEFING )
Original file line number Diff line number Diff line change 11import random
22
33from brain_games .game_engine import game_engine
4- from brain_games .constants import STEP_OF_SEQUENCE
5- from brain_games .constants import PROG_GAME_INTRODUCTION
4+ # from brain_games.constants import STEP_OF_SEQUENCE
5+ from brain_games .constants import PROG_GAME_BRIEFING
66
77
88def get_random_sequence_and_answer ():
@@ -20,4 +20,4 @@ def get_random_sequence_and_answer():
2020
2121
2222def progression_game ():
23- game_engine (get_random_sequence_and_answer , PROG_GAME_INTRODUCTION )
23+ game_engine (get_random_sequence_and_answer , PROG_GAME_BRIEFING )
You can’t perform that action at this time.
0 commit comments