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

Bulls and Cows game #196

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

Conversation

Yaroslav-Kononenko
Copy link

No description provided.

src/app.js Outdated

const { generateNumber } = require('./numGenerator');
const { bullsAndCows } = require('./bullsAndCows');
const { inputFunc } = require('./inputOutput');

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();

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;

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

Copy link

@BudnikOleksii BudnikOleksii 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 👍

@@ -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}$/;

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

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