Skip to content

Comments

Коробицын Александр, FixRobot#2

Open
AlexKorobitsyn wants to merge 4 commits intomasterfrom
fixAllComponents
Open

Коробицын Александр, FixRobot#2
AlexKorobitsyn wants to merge 4 commits intomasterfrom
fixAllComponents

Conversation

@AlexKorobitsyn
Copy link
Owner

Добавил всё в ветку без мусора, Робот находит путь , делая максимум 2… круга

public class GameDataModel extends Observable {
double angularVelocity = 0;
int counter = 0;
private volatile double m_robotPositionX = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

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

PositionX и PositionY - это полноценный класс, выделите его и честно работайте с ним как с "Позицией" робота.

double angularVelocity = 0;
int counter = 0;
private volatile double m_robotPositionX = 100;
public static String KEY_COORDINATE_ROBOT = "robot changed";
Copy link
Collaborator

Choose a reason for hiding this comment

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

сгруппируйте переменные, у Вас идут позиции и между ними KEY_COORDINATE_...

private static final double maxVelocity = 0.1;
private static final double maxAngularVelocity = 0.001;

public double getM_robotPositionX() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

если позицию сгруппируете, то вместо того, чтобы на каждую координату писать по методы, сможете написать Robot.Position.X или Robot.Target.Y

private volatile double m_robotPositionX = 100;
public static String KEY_COORDINATE_ROBOT = "robot changed";
public static String KEY_COORDINATE_TARGET = "target changed";
private volatile double m_robotPositionY = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

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

а выделите робота и цель в отдельные классы, это разные сущности и странно, что робот знает про некую цель.
В идеальной картине мира у Вас есть робот, который умеет как-то двигаться, есть цель и есть Game в котором находится робот и цели и как раз Game честно двигает робота к цели (или устанавливает новую точку).

}


private static double distance(double x1, double y1, double x2, double y2) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

вынесите геометрию в отдельный класс, тут это ни к чему. Геометрию вообще говоря можно как-то переиспользовать в других класса, это нормально, поэтому посмотрите сначала, вдруг уже есть готовая библиотека)

{
m_timer.schedule(new TimerTask()
{
public static class Helpers {
Copy link
Collaborator

Choose a reason for hiding this comment

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

а к чему тут этот класс?
По названию непонятно зачем он нужен, а если посмотреть внутрь, то там 1 метод сравнения.

{
super("Игровое поле", true, true, true, true);

super("������� ����", true, true, true, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

кодировка побилась)

public LogWindow(LogWindowSource logSource)
{
super("Протокол работы", true, true, true, true);
super("�������� ������", true, true, true, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

и тут кодировка)

}
});
testMenu.add(standartExit);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

кажется, именно сюда нужно добавить меню выхода.

private JMenuBar generateMenuBar()
{

private JMenuBar generateMenuBar() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ох, разбейте это на три метода и оставьте только:
muneBar.add(generateLookAndFeelMenu()); muneBar.add(generateTestMenu()); muneBar.add(generateExitMenu());

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