-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulls and Cows game #196
base: master
Are you sure you want to change the base?
Bulls and Cows game #196
Conversation
src/app.js
Outdated
|
||
const { generateNumber } = require('./numGenerator'); | ||
const { bullsAndCows } = require('./bullsAndCows'); | ||
const { inputFunc } = require('./inputOutput'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check function name, let's not make it shortened as it affects in bad way on the code readability
src/app.js
Outdated
|
||
const result = bullsAndCows(secretNumber, guess); | ||
|
||
!result.bulls === 4 && game(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't readable
It's the statement for checking if you should call game
one more time, right? Let's write it with if / else statement
src/app.js
Outdated
}; | ||
|
||
function isValidGuess(guess) { | ||
return /^\d{4}$/.test(guess) && new Set(guess).size === 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create the variable for the template string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work 👍
@@ -9,7 +9,14 @@ | |||
* @return {boolean} - True if the user input is valid, false otherwise | |||
*/ | |||
function checkIsValidUserInput(userInput) { | |||
/* Write your code here */ | |||
const VALID_GUESS_PATTERN = /^\d{4}$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move constants outside the function
No description provided.