Skip to content

Lab1#43

Open
alexbiliba wants to merge 1 commit into
Rrenkens:mainfrom
alexbiliba:main
Open

Lab1#43
alexbiliba wants to merge 1 commit into
Rrenkens:mainfrom
alexbiliba:main

Conversation

@alexbiliba
Copy link
Copy Markdown

Я не сделал изначально форк и из-за этого слетели все коммиты.

ArrayList<Task> tasks = new ArrayList<>();
int current_task_index = -1;

int AC_number = 0;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Для этого предоставляют геттеры и сеттеры и делют их приватными.

* @param taskCount количество заданий в тесте
*/
Quiz(Task.Generator generator, int taskCount) {
while (taskCount > 0) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Почему нельзя делать это лениво?

} else if (current_result == Result.WRONG) {
WA_number++;
} else {
II_number++;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Вряд ли тут соблюдается контракт выше.

@@ -0,0 +1,47 @@
package by.alexbiliba.quizer.task_generators;

import by.alexbiliba.quizer.*;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Не думаю, что здесь все нужно.

* Если этот генератор выбросил исключение в методе generate(), выбирается другой.
* Если все генераторы выбрасывают исключение, то и тут выбрасывается исключение.
*/
public Task generate() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Не соблюдается контракт выше.

if (answerPosition == 0) {
leftNumber = resultNumber / rightNumber;
} else if (answerPosition == 1) {
rightNumber = resultNumber / leftNumber;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

В коде выше могло получиться, что leftNumber = 0.

if (answerPosition == 0) {
leftNumber = resultNumber * rightNumber;
} else if (answerPosition == 1) {
rightNumber = leftNumber / resultNumber;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Тут тоже могло получиться, что resultNumber = 0

} else if (operation == MathTask.Operation.DIFFERENCE) {
leftNumber = resultNumber + rightNumber;
if (answerPosition == 0) {
leftNumber = resultNumber + rightNumber;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Тут нарушается инвариант про диапазон значений.

}
}

return new AbstractMathTask(leftNumber, rightNumber, resultNumber, operation, precision, 2);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Почему всегда 2?

text = "";
if (answerPosition == 0) {
text += 'x';
answer = BigDecimal.valueOf(leftNumber)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Можно вот это было куда-то вынести 5 раз одно и то же.

@Rrenkens Rrenkens added the question Further information is requested label Dec 21, 2022
@Rrenkens
Copy link
Copy Markdown
Owner

Rrenkens commented Dec 21, 2022

Ну пока что такая оценка:

  • -0.15 за импорт всего и вся.
  • -0.25 за неинтуитивность интерфейса.
  • -0.75 за неленивость генерации тасок (а если я хочу тест из 1кк тасок?).
  • -1.5 за pool и group генераторы.
  • -1.5 никогда не будут генериться уравнения.
  • -1.5 за возможное деление на 0 и пропуск abs и нарушение инвариантов.

Допы:

  • +1 за EnumSet.
  • +1 за nested class.
  • +2 за precision во всех его проявлениях. Не всегда верное работает.

В итоге 4.35, коэффициент 0.5 = 2.275. +4 за допы.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants