Skip to content

Add files via upload#42

Open
Lirik02 wants to merge 1 commit into
Rrenkens:mainfrom
Lirik02:lab1
Open

Add files via upload#42
Lirik02 wants to merge 1 commit into
Rrenkens:mainfrom
Lirik02:lab1

Conversation

@Lirik02
Copy link
Copy Markdown

@Lirik02 Lirik02 commented Dec 10, 2022

No description provided.

* @return разница между максимальным и минимальным возможным числом
*/
default int getDiffNumber() {
return 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.

getMaxNumber() - getMinNumber()

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.

пофиксил

import by.Kirill_Chigiryov.quizer.task_generators.*;
import by.Kirill_Chigiryov.quizer.tasks.*;

import java.util.*;
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.

пофиксил

/**
* Interface, который описывает одно задание
*/
public interface Task {
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.

пофиксил

Quiz(TaskGenerator generator, int taskCount) {
this.taskcount = taskCount;
tasks = new Task[taskCount];
for (int i = 0; i < taskCount; i++) {
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.

Лучше сделать лениво, а если я захочу 1кк тасок?

}
String answer = scanner.nextLine();
this.provideAnswer(answer);
if (curtask == tasks.length - 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.

Костыль кокой-то.

public GroupTaskGenerator(Main.TaskGenerator... generators) {
tasks = new ArrayList<>();
for (int i = 0; i < generators.length; i++) {
tasks.add(generators[i].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.

Тут не такая логика, мы можем от одного генератора хотеть больше чем 1 таску.

tasks.add(generators[i].generate());
taskIDs.add(i);
}
taskID = (int) (Math.random() * generators.length);
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.

Зачем это здесь?

* Если все генераторы выбрасывают исключение, то и тут выбрасывается исключение.
*/
public Main.Task generate() {
if (taskIDs.size() == 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.

Тут что-то вообще не то нет рандома, нет исплючений, зачем отдельно проверять на размер 1, заче айдишники?

Collections.addAll(this.tasks, tasks);
if (!allowDuplicate) {
boolean isRepeated = false;
for (int i = 0; i < tasks.length; i++) {
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 случайная задача из списка
*/
public Main.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.

Где случайность? Если нам нужны дубликаты мы оставляем.

@Rrenkens
Copy link
Copy Markdown
Owner

Rrenkens commented Dec 22, 2022

Код ужасный!!!
Ну пока что такая оценка:

  • -0.75 за отметание хороших примеров и проверку в текстовых задачах.
  • -1.5 за структуру кода.
  • -3 за ошибки и дублирование во всех генераторах и задачах.

В итоге 4.75.

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