Add files via upload#42
Open
Lirik02 wants to merge 1 commit into
Open
Conversation
Rrenkens
reviewed
Dec 22, 2022
| * @return разница между максимальным и минимальным возможным числом | ||
| */ | ||
| default int getDiffNumber() { | ||
| return 0; |
Owner
There was a problem hiding this comment.
getMaxNumber() - getMinNumber()
| import by.Kirill_Chigiryov.quizer.task_generators.*; | ||
| import by.Kirill_Chigiryov.quizer.tasks.*; | ||
|
|
||
| import java.util.*; |
| /** | ||
| * Interface, который описывает одно задание | ||
| */ | ||
| public interface Task { |
Owner
There was a problem hiding this comment.
Принятно каждый класс (если он по смыслу не внутренний) выносить. отдельные файлы. А тут какое-то мессиво.
| Quiz(TaskGenerator generator, int taskCount) { | ||
| this.taskcount = taskCount; | ||
| tasks = new Task[taskCount]; | ||
| for (int i = 0; i < taskCount; i++) { |
Owner
There was a problem hiding this comment.
Лучше сделать лениво, а если я захочу 1кк тасок?
| } | ||
| String answer = scanner.nextLine(); | ||
| this.provideAnswer(answer); | ||
| if (curtask == tasks.length - 1) { |
| public GroupTaskGenerator(Main.TaskGenerator... generators) { | ||
| tasks = new ArrayList<>(); | ||
| for (int i = 0; i < generators.length; i++) { | ||
| tasks.add(generators[i].generate()); |
Owner
There was a problem hiding this comment.
Тут не такая логика, мы можем от одного генератора хотеть больше чем 1 таску.
| tasks.add(generators[i].generate()); | ||
| taskIDs.add(i); | ||
| } | ||
| taskID = (int) (Math.random() * generators.length); |
| * Если все генераторы выбрасывают исключение, то и тут выбрасывается исключение. | ||
| */ | ||
| public Main.Task generate() { | ||
| if (taskIDs.size() == 1) { |
Owner
There was a problem hiding this comment.
Тут что-то вообще не то нет рандома, нет исплючений, зачем отдельно проверять на размер 1, заче айдишники?
| Collections.addAll(this.tasks, tasks); | ||
| if (!allowDuplicate) { | ||
| boolean isRepeated = false; | ||
| for (int i = 0; i < tasks.length; i++) { |
| /** | ||
| * @return случайная задача из списка | ||
| */ | ||
| public Main.Task generate() { |
Owner
There was a problem hiding this comment.
Где случайность? Если нам нужны дубликаты мы оставляем.
Owner
|
Код ужасный!!!
В итоге 4.75. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.