# @leusmaximus/brain-games

During the project it is necessary to implement a set of mini-games that are launched from the console. These games are similar to what is commonly called "Brain Games".

## Stats

StarsIssuesVersionUpdatedCreatedSize
@leusmaximus/brain-games
000.1.193 years ago3 years ago

# Brain Games

Brain Games this is a set of mini-games that are launched from the console. These games are similar to what is commonly called "Brain Games".

## Installation

`npm i -g @leusmaximus/brain-games`

After the installation, commands starting with the `brain-<game name>` will be available in your console.

## Usage

This module includes such games:

### Brain Balance

The game "Balance the given number". A balanced number is a number in which the smallest digit differs from the largest one by more than one. The user must calculate and enter the balanced number.

Example:

``````\$ brain-balance

Welcome to the Brain Game!
Balance the given number.

May I have your name? Max
Hello, Max!

Question: 215
Correct!
Question: 4181
Correct!
Question: 355
Correct!
Congratulations, Max!
``````

Demo

### Brain Calc

Game "Calculator". The essence of the game is as follows: the user is shown a random mathematical expression, for example 35 + 16, which you need to calculate and write the correct answer.

Example:

``````\$ brain-calc

Welcome to the Brain Games!
What is the result of the expression?

May I have your name? Max
Hello, Max!

Question: 4 + 10
Correct!
Question: 25 - 11
Correct!
Question: 25 * 7
Correct!
Congratulations, Max!
``````

Demo

### Brain Even

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

Example:

``````\$ brain-even

Welcome to the Brain Games!

May I have your name? Max
Hello, Max!

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

Demo

### Brain gcd

The game "the greatest common divisor (GCD)". The essence of the game is as follows: the user is shown two random numbers, for example, 25 50. The user must calculate and enter the greatest common divisor of these numbers.

Example:

``````\$ brain-gcd

Welcome to the Brain Games!
Find the greatest common divisor of given numbers.

May I have your name? Max
Hello, Max!

Question: 25 50
Correct!
Question: 100 52
Correct!
Question: 3 9
Correct!
Congratulations, Max!
``````

Demo

### Brain Prime

The game "Is Prime". A prime number is a whole number greater than 1 whose only factors are 1 and itself. The user must to answer yes, if the number is prime, or no - if not.

Example:

``````\$ brain-prime

Welcome to the Brain Games!

May I have your name? Max
Hello, Max!

Question: 17
Correct!
Question: 21
Correct!
Question: 113
Correct!
Congratulations, Max!
``````

Demo

### Brain Progression

We show the player a series of numbers, forming an arithmetic progression, replacing any of the numbers with two points. The player must determine this number.

Example:

``````\$ brain-progression

Welcome to the Brain Games!
What number is missing in this progression?.

May I have your name? Max
Hello, Max!

Question: 5 7 9 11 13 .. 17 19 21 23