Skip to content

Прошу проверить ДЗ1 - #1

Open
Ekarry wants to merge 3 commits into
masterfrom
Lesson1
Open

Прошу проверить ДЗ1#1
Ekarry wants to merge 3 commits into
masterfrom
Lesson1

Conversation

@Ekarry

@Ekarry Ekarry commented May 14, 2021

Copy link
Copy Markdown
Owner

No description provided.

import java.util.Random;

public class JustDoIt {
public JustDoIt() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

зачем тут конструктор?

Lesson1.Actions[] actions = new Lesson1.Actions[3];
int distance = rand.nextInt(10);
int heigth = rand.nextInt(10);
actions[0] = new Lesson1.Human("Peter", distance, heigth);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

классы можно импортировать, чтобы не дергать Lesson1.Human

if (!result) {
break;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

отличное решение. Вы догадались что у класса, символизирующего препятствие должен быть один метод, который будет переопределен в конкретной реализации. Пока лучшее решение

} else {
barriers[i] = new Lesson1.Wall(i + 1 + " is Wall", distance);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

по организации кода замечание - метод main у нас должен отражать соревнование. Поготовка данных тут занимает больше места чем непосредственно решение, можно вынести в отдельные методы
generateBarriers, generateParticipants

Ekarry added 2 commits May 18, 2021 22:36
Откорректировала по замечаниям - не смогла только по барьерам
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants