Skip to content

Tetris_Blinova#14

Open
MuraBlinova wants to merge 1 commit into
hBuzzy:masterfrom
MuraBlinova:Tetris
Open

Tetris_Blinova#14
MuraBlinova wants to merge 1 commit into
hBuzzy:masterfrom
MuraBlinova:Tetris

Conversation

@MuraBlinova

Copy link
Copy Markdown

No description provided.

@hBuzzy hBuzzy left a comment

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.

Исправить замечания для принятия основного задания. Доп задание принято.

Очень много ошибок с пробелами и скобками, не стал писать на каждом месте комментарий. Не всегда соблюдается принятый стиль кода. В остальном - хорошо.

Comment thread figure.cpp
@@ -0,0 +1,120 @@
#include "figure.h"

figure::figure()

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.

Классы с большой буквы.

Comment thread figure.h
Comment on lines +34 to +38
int m_x;
int m_y;
int m_condition;
QColor m_color;
QVector<QVector<QVector<bool>>> m_data;

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.

В нашей нотации (по google) приватные поля именуются все же с постфиксом "_". m_x -> x_ и т.д.

Comment thread griddrawer.cpp
#include "griddrawer.h"

GridDrawer::GridDrawer(QWidget *parent):QWidget(parent), m_columns(3), m_rows(4), m_sizeCell(30)
{

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.

Раз начали внутри кода не переносить скобки, то они не переносятся и в методах. Везде в одном стиле.

Comment thread figure.cpp
Comment on lines +71 to +106
case 1:
m_data = {{{1,1,1,1}}, {{1},{1},{1},{1}}};
break;
case 2:
m_data = {{{1,0},{1,1},{1,0}},
{{1,1,1},{0,1,0}},
{{0,1},{1,1},{0,1}},
{{0,1,0},{1,1,1}}
};
break;
case 3:
m_data = {{{1,1},{1,0},{1,0}},
{{1,1,1},{0,0,1}},
{{0,1},{0,1},{1,1}},
{{1,0,0},{1,1,1}}
};
break;
case 4:
m_data = {{{1,1},{0,1},{0,1}},
{{0,0,1},{1,1,1}},
{{1,0},{1,0},{1,1}},
{{1,1,1},{1,0,0}}
};
break;
case 5:
m_data = {{{1,0},{1,1},{0,1}},
{{0,1,1},{1,1,0}}
};
break;
case 6:
m_data = {{{0,1},{1,1},{1,0}},
{{1,1,0},{0,1,1}}
};
break;
default:
break;

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.

case должны быть на одну табуляцию правее от switch

Comment thread figure.cpp
}
}

void figure::setSpecificData(QVector<QVector<QVector<bool>>> data_){

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.

Постфикс "_" для параметров методов не нужен. Пробел перед { (касается всего проекта, унифицируйте написание скобок и поправьте отступы)

Comment thread tetris.cpp
Comment on lines +25 to +32
for(int j = 0; j < grid->rows()+5; j++){
if(i == 0 || i == grid->columns() + 1 || j == grid->rows() + 4){
gridInt[i].push_back(1);
}else{
gridInt[i].push_back(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.

Пробел после for, if и перед { и else.

5 - магическое число. Отделить оператор сложения с двух сторон пробелами.

Comment thread tetris.cpp
Comment on lines +34 to +40
for(int i = 0; i < figure_->data()[cond].size(); i++){
for(int j = 0; j < figure_->data()[cond][i].size(); j++){
if(figure_->data()[cond][i][j]){
gridInt[i + x][j + y] = 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.

Пробелы после for, if и перед {. Касается всего проекта. Дальше уже повторять комментарий не будут.

Comment thread tetris.cpp
Comment on lines +76 to +97
for(int j = grid->rows() + 3; j >= 0; j--){
bool ind = true;
for(int i = 0; i < grid->columns()+2; i++){
if(gridInt[i][j] == 0){
ind = false;
break;
}
}
if(ind){
emit fullRow();
for(int i = 0; i < grid->columns()+2; i++){
gridInt[i].remove(j);
if(i == 0 || i == grid->columns()+1){
gridInt[i].push_front(1);
}else{
gridInt[i].push_front(0);
}
}
j++;
}
}
}

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.

3, 2 - магические числа. ind ? Во-первых не соответствует нотации названия bool переменных / полей, во-вторых название не несет вообще никакого смысла.

Comment thread tetris.cpp

bool tetris::moveFigureDown(){
int maximumHeightFigure = 4;
bool ind = true;

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.

Читать замечание к Ind выше

Comment thread tetris.h
void onFigureChanged(figure* newFigure) {
figure_ = newFigure;
}
void newGame();

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.

newGame -> startNewGame

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