## README

# Brain Games

BrainGames is a set of mini-games launched from the console.

## Setup

```
$ make install
```

## List of games

- Brain-calc
- Brain-even
- Brain-gcd
- Brain-prime
- Brain-progression

## The game scenario is structured as follows:

The user is shown a description of the game. The next question is asked. In the case of three correct answers in a row, the game ends with a congratulation. Otherwise, the game fails.

## Brain-calc

The essence of the game is as follows: the user is shown a random mathematical expression, for example 35 + 16, which needs to be calculated and written down the correct answer:

```
$ brain-calc
Welcome to the Brain Games!
What is the result of the expression?
May I have your name? Sam
Hello, Sam!
Question: 4 + 10
Your answer: 14
Correct!
Question: 25 - 11
Your answer: 14
Correct!
Question: 25 * 7
Your answer: 175
Correct!
Congratulations, Sam!
```

### An example of a game with the wrong answer:

```
Question: 25 * 7
Your answer: 145
'145' is wrong answer ;(. Correct answer was '175'.
Let's try again, Sam!
```

## Brain-even

The essence of the game is as follows: a random number is shown to the user. And he needs to answer yes if the number is even, or no if it is odd:

```
$ brain-even
Welcome to the Brain Games!
Answer "yes" if the number is even, otherwise answer "no".
May I have your name? Sam
Hello, Sam!
Question: 15
Your answer: no
Correct!
Question: 6
Your answer: yes
Correct!
Question: 7
Your answer: no
Correct!
Congratulations, Sam!
```

### An example of a game with the wrong answer:

```
Question: 15
Your answer: no
'yes' is wrong answer ;(. Correct answer was 'no'.
Let's try again, Sam!
```

## Brain-gcd

The essence of the game is as follows: two random numbers are shown to the user, for example, 25 50. The user must calculate and enter the largest common divisor of these numbers. The conclusion should be the following:

```
$ brain-gcd
Welcome to the Brain Games!
Find the greatest common divisor of given numbers.
May I have your name? Sam
Hello, Sam!
Question: 25 50
Your answer: 25
Correct!
Question: 100 52
Your answer: 4
Correct!
Question: 3 9
Your answer: 3
Correct!
Congratulations, Sam!
```

### An example of a game with the wrong answer:

```
Question: 25 50
Your answer: 25
'50' is wrong answer ;(. Correct answer was '25'.
Let's try again, Sam!
```

## Brain-progression

The essence of the game is as follows: the player is shown a series of numbers forming an arithmetic progression, where any of the numbers is replaced by two points. The player must determine this number.

```
$ brain-progression
Welcome to the Brain Game!
What number is missing in this progression?
May I have your name? Roman
Hello, Roman!
Question: 14 .. 18 20 22 24 26 28
Your answer: 16
Correct!
Question: 5 6 7 8 9 .. 11 12
Your answer: 10
Correct!
Question: 12 15 18 21 .. 27 30 33
Your answer: 24
Correct!
Congratulations, Roman!
```

### An example of a game with the wrong answer:

```
Question: 14 .. 18 20 22 24 26 28
Your answer: 15
'15' is wrong answer ;(. Correct answer was '16'.
Let's try again, Roman!
```

## Brain-prime

The essence of the game is as follows: user is shown a random number. And he needs to answer yes if the number is prime, or no if it is not simple:

```
$ brain-prime
Welcome to the Brain Game!
Answer "yes" if given number is prime. Otherwise answer "no".
May I have your name? Roman
Hello, Roman!
Question: 13
Your answer: yes
Correct!
Question: 97
Your answer: yes
Correct!
Question: 24
Your answer: no
Correct!
Congratulations, Roman!
```

### An example of a game with the wrong answer:

```
Question: 100
Your answer: yes
'yes' is wrong answer ;(. Correct answer was 'no'.
Let's try again, Roman!
```