Skip to content

Commit

Permalink
Возврат
Browse files Browse the repository at this point in the history
  • Loading branch information
blackgoldi committed Dec 23, 2024
1 parent c13c27c commit b52a063
Show file tree
Hide file tree
Showing 1,277 changed files with 256,256 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ install:
brain-games:
node bin/brain-games.js
node src/cli.js
brain-even:
node bin/brain-games.js
node bin/brain-even.js
publish:
npm publish --dry-run
lint:
Expand Down
21 changes: 21 additions & 0 deletions bin/brain-even.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import readlineSync from 'readline-sync';
import name from '../src/cli.js';

const isEven = (num) => num % 2 == 0;
let counter = 0;
do {
let rnd = Math.round(Math.random() * 10);
console.log(`Question: ${rnd}`);
let correctAnswer = isEven(rnd) ? 'yes' : 'no';
let answer = readlineSync.question('Your answer: ').toLowerCase();
if (correctAnswer == answer) {
counter++;
console.log('Correct');
}
else {
console.log(`'${answer}' is wrong answer ;(. Correct answer was '${correctAnswer}'`);
console.log(`Let's try again, ${name}!`);
break;
}
} while (counter < 3);
if (counter == 3) console.log(`Congratulations, ${name}!`);
2 changes: 0 additions & 2 deletions bin/brain-games.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node



console.log("Welcome to the Brain Games!");
16 changes: 16 additions & 0 deletions node_modules/.bin/acorn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/acorn.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/acorn.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/eslint

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/eslint.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/eslint.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/js-yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/js-yaml.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/js-yaml.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/node-which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/node-which.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/node-which.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b52a063

Please sign in to comment.