File tree Expand file tree Collapse file tree 12 files changed +98
-48
lines changed Expand file tree Collapse file tree 12 files changed +98
-48
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,16 @@ brain-games:
55 node bin/brain-games.js
66
77publish :
8- bra --dry-run
8+ npm publish --dry-run
99
1010lint :
1111 npx eslint .
1212
1313brain-even :
1414 node bin/brain-even.js
1515
16+ brain-calc :
17+ node bin/brain-calc.js
18+
1619fix :
1720 npx eslint --fix .
Original file line number Diff line number Diff line change 11### Hexlet tests and linter status:
22[ ![ Actions Status] ( https://github.com/WisdomQuest/frontend-project-44/actions/workflows/hexlet-check.yml/badge.svg )] ( https://github.com/WisdomQuest/frontend-project-44/actions )
3- https://asciinema.org/a/zNBty6rqBic6N4Zn5Dmt2Sscb
3+ https://asciinema.org/a/zNBty6rqBic6N4Zn5Dmt2Sscb
4+ https://asciinema.org/a/1gZpYskJ5KBIjVJ1hPz54XRTA
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ import { welcomeUser } from '../src/games/cli.js' ;
3+ import calcGame from '../src/games/calc.js' ;
4+
5+ welcomeUser ( ) ;
6+ calcGame ( ) ;
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import { welcomeUser } from '../src/cli.js' ;
3- import evenGame from '../src/cliEven.js' ;
2+ import { welcomeUser } from '../src/games/ cli.js' ;
3+ import evenGame from '../src/games/ cliEven.js' ;
44
55welcomeUser ( ) ;
66evenGame ( ) ;
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import { welcomeUser } from '../src/cli.js' ;
2+ import { welcomeUser } from '../src/games/ cli.js' ;
33
44welcomeUser ( ) ;
Original file line number Diff line number Diff line change 2020 "bin" : {
2121 "code" : " bin/brain-games.js" ,
2222 "brain-games" : " bin/brain-games.js" ,
23- "brain-even" : " bin/brain-even.js"
23+ "brain-even" : " bin/brain-even.js" ,
24+ "brain-calc" : " bin/brain-calc.js"
2425 },
2526 "dependencies" : {
2627 "lodash" : " ^4.17.21" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import roundGame from '../index.js' ;
2+ import randomNumber from '../utilRandomNumber.js' ;
3+
4+ const descriptionGame = 'What is the result of the expression?' ;
5+
6+ const actionGame = ( ) => {
7+ const sign = [ '+' , '-' , '*' ] ;
8+ const randomSiqn = sign [ randomNumber ( 3 ) ] ;
9+ const Num1 = randomNumber ( 11 ) ;
10+ const Num2 = randomNumber ( 11 ) ;
11+ let correctAnswer = '' ;
12+ const questionMath = `${ Num1 } ${ randomSiqn } ${ Num2 } ` ;
13+ switch ( randomSiqn ) {
14+ case '+' :
15+ correctAnswer = Num1 + Num2 ;
16+ break ;
17+ case '-' :
18+ correctAnswer = Num1 - Num2 ;
19+ break ;
20+ case '*' :
21+ correctAnswer = Num1 * Num2 ;
22+ break ;
23+ default :
24+ }
25+ return [ questionMath , String ( correctAnswer ) ] ;
26+ } ;
27+
28+ const calcGame = ( ) => {
29+ console . log ( descriptionGame ) ;
30+ roundGame ( actionGame ) ;
31+ } ;
32+
33+ export default calcGame ;
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import roundGame from '../index.js' ;
2+ import randomNumber from '../utilRandomNumber.js' ;
3+
4+ const descriptionGame = 'Answer "yes" if the number is even, otherwise answer "no".' ;
5+
6+ const actionGame = ( ) => {
7+ const questNumber = randomNumber ( ) ;
8+ const isEvenNum = questNumber % 2 === 0 ;
9+ const correctAnswer = isEvenNum ? 'yes' : 'no' ;
10+
11+ return [ questNumber , correctAnswer ] ;
12+ } ;
13+
14+ const evenGame = ( ) => {
15+ console . log ( descriptionGame ) ;
16+ roundGame ( actionGame ) ;
17+ } ;
18+
19+ export default evenGame ;
You can’t perform that action at this time.
0 commit comments