numonebg

first project

Usage no npm install needed!

<script type="module">
  import numonebg from 'https://cdn.skypack.dev/numonebg';
</script>

README

brain-games

Maintainability Build Status

(First start in package making & publishing)

Project is made during studying the web-dev on Hexlet.

It includes 6 simple math games to be launched as console applications. To see all possible games to play You should just type brain-games in your command-line. You'll see an invitation, name-input line and a games list with their ordinal numbers:

Welcome to the Brain Games!

What's Ur name, dear guest ?: zorro
Hello, zorro !


[1] makeBalance
[2] simpleCalculator
[3] isEven
[4] GCDgame
[5] primeNumber
[6] progression
[0] CANCEL

Choose a game number from the list above [1...6 / 0]:

All of them have next common logic:

1) after launching a game a description of this game appears(example):

 `Is this number prime?`

2) then the game will ask You to input your name:

 `What's Ur name, dear guest ?: me
 Hello, me !`

3) after that You have first task displayed with a random number(s) (example):

 `Question: 15`

If your answer is correct

 `Your answer: no`,

You get the approval message

 `Correct!`

and go to the next level ( 3 in total ).
If it's not, You have folloving message:

 `'yes' is wrong answer ;(. Correct answer was no.
  Let's try again, me!`

4) notice that your answer must be "yes"/"no" or a sertain number - it depends from the description of a game. Also if you input any other string it will be interpreted as "no".

Games start & description with output samples

Each game launches by its name and have its own "question":

  • primeNumber

    You need to define whether the displayed number is prime or not:

    Question: 15
    Your answer: no
    Correct!
    Question: 79
    Your answer: yes
    
  • progression

    In this game You need to calculate missed arithmetic progression value:

    Question: 7,79,..,223,295,367,439,511,583,655
    Your answer: 151
    Correct!
    Question: 65,160,..,350,445,540,635,730,825,920
    Your answer: 
    
  • makeBalance

    You have a number which you need to "balance": balanced number is a number where numerals differ from each other by 1 or are equal: 4455, 2233, 56, 777 etc. So if You got, for example, 4181 your answer should be 3344 and so on:

    Question: 1103
    Your answer: 1112
    Correct!
    Question: 9024
    
  • GCDgame

    In this game You will get two numbers and You'll have to calculate their GCD:

    Question: 8 24
    Your answer: 8
    Correct!
    Question: 8 55
    Your answer: 
    
  • simpleCalculator

    Adding, subtraction or multiplication of two values:

    Question: 71 + 56
    Your answer: 127
    Correct!
    Question: 22 - 70
    Your answer:
    
  • isEven

    Here You need to answer whether a given number is even or not:

    Question: 68
    Your answer: yes
    Correct!
    Question: 26
    Your answer:
    

Prerequisites

To be able to install & run brain-games the npm must be installed on your computer.

Installation

$ npm install -g numonebg