Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Develop #250

wants to merge 5 commits into from

Conversation

kaavka
Copy link

@kaavka kaavka commented Oct 6, 2023

Implement Bulls and cows game

Copy link

@rostyslav48 rostyslav48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good👍

Copy link

@Moroz-Dmytro Moroz-Dmytro left a 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

src/userInterface.js Outdated Show resolved Hide resolved
src/app.js Outdated Show resolved Hide resolved
src/app.js Outdated Show resolved Hide resolved
Comment on lines 5 to 7
function generateNumber() {
return Math.round(Math.random() * (MAX_NUMBER - MIN_NUMBER) + MIN_NUMBER);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Your function doesn't generate number with different digits
image

src/app.js Outdated

function askQuestion() {
terminal.question(QUESTION, (userNumber) => {
if (userNumber.length !== EXPECTED_NUMBER_LENGTH) {

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

Copy link

@Moroz-Dmytro Moroz-Dmytro left a 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

Comment on lines 5 to 12
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;
};

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants