# brain-games-afanasev7

my first js project

## Usage no npm install needed!

``````<script type="module">
import brainGamesAfanasev7 from 'https://cdn.skypack.dev/brain-games-afanasev7';
</script>``````

# Brain Games

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

## Setup

``````\$ make install
``````

## List of games

1. Brain-calc
2. Brain-even
3. Brain-gcd
4. Brain-prime
5. 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
Correct!
Question: 25 - 11
Correct!
Question: 25 * 7
Correct!
Congratulations, Sam!
``````

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

``````Question: 25 * 7
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!

May I have your name? Sam
Hello, Sam!

Question: 15
Correct!
Question: 6
Correct!
Question: 7
Correct!
Congratulations, Sam!
``````

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

``````Question: 15
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
Correct!
Question: 100 52
Correct!
Question: 3 9
Correct!
Congratulations, Sam!
``````

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

``````Question: 25 50
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
Correct!
Question: 5 6 7 8 9 .. 11 12
Correct!
Question: 12 15 18 21 .. 27 30 33
Correct!
Congratulations, Roman!
``````

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

``````Question: 14 .. 18 20 22 24 26 28
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!

May I have your name? Roman
Hello, Roman!

Question: 13
Correct!
Question: 97
Correct!
Question: 24
``````Question: 100