Skip to content

Lab 01#27

Open
Marmotikon wants to merge 9 commits into
Rrenkens:mainfrom
Marmotikon:lab-01
Open

Lab 01#27
Marmotikon wants to merge 9 commits into
Rrenkens:mainfrom
Marmotikon:lab-01

Conversation

@Marmotikon
Copy link
Copy Markdown

No description provided.

public static void main(String[] args) {
Map<String, Quiz> quizMap = getQuizMap();
Scanner sc = new Scanner(System.in);
System.out.println("Введите название теста...");
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.

А откуда я их без кода возьму?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

"Учитель врывается в класс и решает провести плановую проверку знаний, большими буквами на доске пишет название теста"

ApplesTaskGenerator applesTaskGenerator = new ApplesTaskGenerator(
0, 10);

List<Task> AnimalTasksPool = List.of(
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.

Wow!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Если вы про перенос, то Done.

this.answer = other.answer;
}

@Override
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.

Наверное, можно было объединить с TextTask.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Пока не придумал как, у них ответ разного типа и в MathTask есть генератор, а в TextTask - нет.

@@ -0,0 +1,7 @@
package by.marmotikon.quizer.tasks.math_tasks;

public class AnimalsTask extends AbstractMathTask {
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.

Больше похоже на текстовую таску.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

private final ArrayList<Task> tasks;
Map<Result, Integer> Answers;
int index = -1;
private boolean isFinished = false;
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.

Думаю, можно было обойтись Answers[WRONG] + Answers[OK] == tasks.size()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

answer = new Number(b.getValue() * a.toInt(), precision);
}
case DIVISION -> {
while (b.isZero()) {
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.

Вот из-за того, что ты не сравнивашь на epsilon у тебя могут генерироваться примеры вида 0/0. Это касается и второго типа тасок.

import java.util.*;

public class GroupTaskGenerator implements Task.TaskGenerator {
private final Vector<Task.TaskGenerator> generators;
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.

Это не C++! В данном месте роли не играет, но лучше по-дефолту юзать ArrayList.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

public PoolTaskGenerator(boolean allowDuplicate, Collection<Task> tasks) {
this.allowDuplicate = allowDuplicate;
this.tasks = tasks.stream().toList();
System.out.println(this.tasks.size() + " size");
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.

А зачем мне debug информация((

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

PoolTaskGenerator(boolean allowDuplicate, Task... tasks) {
this.allowDuplicate = allowDuplicate;
this.tasks = List.of(tasks);
freeTaskIndexes = Stream.iterate(0, n -> n + 1)
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.

Изначально могут совпадать таски их тоже надо отфильтровать под флагом allowDuplicate.

* @return случайная задача из списка
*/
public Task generate() {
System.out.println("freeTaks size " + freeTaskIndexes.size());
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.

Лучше было бы сделать randomShuffle, так мы кушаем доп память на список индексов.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

@Rrenkens
Copy link
Copy Markdown
Owner

Rrenkens commented Dec 6, 2022

Тут много комменатриев, но снимал я за:

  • -0.05 за debug.
  • -0.25 за неинтуитивность интерфейса.
  • -0.25 за доп память на индексах.
  • -0.3 за генерацию 0/0, с выдачей рандомного ответа.
  • -0.5 за не верное завершение квиза. (Довольно редкий кейс, поэтому не -2.5, но все равно ломает основную логику).
  • -0.5 за не ленивую генерацию заданий.

Допы:

  • +1 за EnumSet.
  • +1 за nested class.
  • +3 за precision во всех его проявлениях.
  • +0 за UML. Это диаграмма классов, а нужно показать их взаимодействие между собой.

В итоге 8.15. В остальном классная работа и почти правильное деление)). +5 за допы.

@Rrenkens Rrenkens added the question Further information is requested label Dec 6, 2022
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