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

MNG-27_question_generator #22

Merged
merged 8 commits into from
Jan 8, 2021
Merged

MNG-27_question_generator #22

merged 8 commits into from
Jan 8, 2021

Conversation

mariusz-sm
Copy link
Collaborator

No description provided.

for (let i = 1; i <= 4; i++) {
currentQuestionsArray.push(randomNumberInRange(this.minPokeId, this.maxPokeId, this.askedQuestions));
};
this.askedQuestions = this.askedQuestions.concat(currentQuestionsArray);
Copy link
Owner

Choose a reason for hiding this comment

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

In my opinion it would be better to use push() instead of concat() here.
Check: https://stackoverflow.com/questions/44572026/difference-between-concat-and-push

but both works fine 🤷

Copy link
Owner

@lukaszdutka lukaszdutka left a comment

Choose a reason for hiding this comment

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

also, the algorithm is wrong - you mixed askedQuestions array and currentQuestionArray array. Those should be used differently.

Reminder/hint:
the only nonrepeating things are:

  • 4/6 answers in one question should be nonrepeating (it is currentQuestionArray)
  • all 30 correct answers in whole quiz should be nonrepeating (it is askedQuestions), bad answers can within whole quiz can repeat.

Copy link
Owner

@lukaszdutka lukaszdutka 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! :)

@lukaszdutka lukaszdutka merged commit 9408f99 into dev Jan 8, 2021
@lukaszdutka lukaszdutka deleted the MNG-27_question_generator branch January 8, 2021 17:37
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.

2 participants