-
Notifications
You must be signed in to change notification settings - Fork 530
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
Develop #250
base: master
Are you sure you want to change the base?
Develop #250
Conversation
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.
Looks good👍
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 ⭐
Small comments
…nge argument name for question callback
src/generateNumber.js
Outdated
function generateNumber() { | ||
return Math.round(Math.random() * (MAX_NUMBER - MIN_NUMBER) + MIN_NUMBER); | ||
} |
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.
src/app.js
Outdated
|
||
function askQuestion() { | ||
terminal.question(QUESTION, (userNumber) => { | ||
if (userNumber.length !== EXPECTED_NUMBER_LENGTH) { |
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.
You should also check if user entered number with different digits
…s, create validate input module
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.
👍
But check comment below, to make it perfect
src/validateInput.js
Outdated
function validateInput(input) { | ||
const inputSplited = input.split(''); | ||
const inputSet = new Set(inputSplited); | ||
const hasValidLength = inputSplited.length === EXPECTED_NUMBER_LENGTH; | ||
const hasDistinctDigits = inputSplited.length === inputSet.size; | ||
|
||
return hasValidLength && hasDistinctDigits; | ||
}; |
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.
Also you need to check if user entered only numbers
If user enter 123q
your game will never finish
Implement
Bulls and cows
game