Lab 1: Quizer#29
Open
DudkoAndrei wants to merge 24 commits into
Open
Conversation
Rrenkens
reviewed
Dec 7, 2022
| this.answer = answer; | ||
| } | ||
|
|
||
| @Override |
Owner
There was a problem hiding this comment.
Вот этот метод можно было объединить с MathTask и сделать какой-то абстрктный класс.
| * исключение, то и тут выбрасывается исключение. | ||
| */ | ||
| public Task generate() { | ||
| Collections.shuffle(generators); |
Owner
There was a problem hiding this comment.
Можно было 1 раз зашафлить и ходить по кругу. Shuffle дорогая операция и явно здесь не требуется больше одного раза.
| this.allowDuplicate = allowDuplicate; | ||
| this.tasks = new ArrayList<>(tasks); | ||
|
|
||
| if (!allowDuplicate) { |
Owner
There was a problem hiding this comment.
Надо еще проверить, что в изначальных задачах нету дубликатов.
|
|
||
| private Task currentTask = null; | ||
| private final int taskCount; | ||
| private boolean answeredOnCurrentTask = false; |
Owner
There was a problem hiding this comment.
Мне кажется, что лучше хранить последний результат.
| } | ||
|
|
||
| double getRandomDouble() { | ||
| return truncate(rnd.nextDouble(minNumber, maxNumber + Double.MIN_VALUE), precision); |
| super(operation.compute(firstNumber, secondNumber), precision); | ||
|
|
||
| df.setMaximumFractionDigits(precision); | ||
| df.setMinimumFractionDigits(precision); |
| boolean isFirstNumberUnknown = rnd.nextBoolean(); | ||
| Operation operation = getRandomOperation(); | ||
|
|
||
| if (operation == Operation.DIVIDE && isDoubleEqual(secondNumber, 0.0, eps)) { |
Owner
There was a problem hiding this comment.
Вот 0 / x = 0 релевантный пример.
| if (operation == Operation.DIVIDE && isDoubleEqual(secondNumber, 0.0, eps)) { | ||
| operation = Operation.MULTIPLY; | ||
| } | ||
| if (operation == Operation.MULTIPLY && isDoubleEqual(firstNumber, 0.0, eps)) { |
Owner
There was a problem hiding this comment.
а тут чем 0.0 * x = 0.0 не подойдет?
Owner
|
Ну пока что такая оценка:
Допы:
В итоге 9.25. В остальном супер-пупер. +5 за допы. |
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.
Сделаны все допы, кроме чтения из json-ов