Skip to content

Tetris v.1#10

Open
S-V-N wants to merge 1 commit into
hBuzzy:masterfrom
S-V-N:Shatokhin-Tetris
Open

Tetris v.1#10
S-V-N wants to merge 1 commit into
hBuzzy:masterfrom
S-V-N:Shatokhin-Tetris

Conversation

@S-V-N

@S-V-N S-V-N commented Dec 4, 2023

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 figures.cpp
Comment on lines +2 to +7
Figures::Figures()
{
}
Figures::~Figures()
{
}

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 figures.cpp
@@ -0,0 +1,84 @@
#include "figures.h"
Figures::Figures()

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.

Блоки Include Отделяем от всего остального пустой строкой

Comment thread figures.cpp
Figures::~Figures()
{
}
std::vector<std::vector<int> > Figures::getFigure(int figure, int state) {

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.

Методы отделяем друг от друга пустой строкой. Лишний пробел <int> > -> <int>>

Comment thread figures.cpp
Comment on lines +9 to +14
if ( figure < 1 ) figure = 1;
else if ( figure > 7 ) figure = 7;
if ( state < 1 ) state = 1;
else if ( state > 4 ) state = 4;
std::vector<std::vector<int> > v;
for ( int i = 0; i < 4; 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, 4, 7 и т.д. в коде ниже - магические значения. Что это ? Как понять? Выделите в поля / переменные.

Comment thread figures.cpp
Comment on lines +19 to +79
} else if ( figure == 2 ) {
if ( state == 1 ) {
a.push_back(Figures::figure2_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure2_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure2_3[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure2_4[i][j]);
}
} else if ( figure == 3 ) {
if ( state == 1 ) {
a.push_back(Figures::figure3_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure3_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure3_3[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure3_4[i][j]);
}
} else if ( figure == 4 ) {
if ( state == 1 ) {
a.push_back(Figures::figure4_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure4_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure4_3[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure4_4[i][j]);
}
} else if ( figure == 5 ) {
if ( state == 1 ) {
a.push_back(Figures::figure5_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure5_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure5_3[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure5_4[i][j]);
}
} else if ( figure == 6 ) {
if ( state == 1 ) {
a.push_back(Figures::figure6_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure6_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure6_3[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure6_4[i][j]);
}
} else if ( figure == 7 ) {
if ( state == 1 ) {
a.push_back(Figures::figure7_1[i][j]);
} else if ( state == 2 ) {
a.push_back(Figures::figure7_2[i][j]);
} else if ( state == 3 ) {
a.push_back(Figures::figure7_1[i][j]);
} else if ( state == 4 ) {
a.push_back(Figures::figure7_2[i][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.

Весь блок явно должен быть левее по отступам.

Comment thread logic.cpp
Comment on lines +191 to +192
if (i + CurrentPiece.Y > 19) return false;
if (j + CurrentPiece.X > 9) return 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.

19 и 9 - это что?

Comment thread logic.cpp
Comment on lines +171 to +172
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; 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.

4 - это что?

Comment thread logic.cpp
score += 100;
k++;
num_lines++;
if (num_lines % 5 == 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.

5 - магическое число.

Comment thread logic.cpp
Comment on lines +119 to +129
for (int k = 19; k >= 1; k--)
{
int c = 0;
for (int i = 0; i < 10; i++)
if (Board[k][i] != 0)
c++;
if (c == 10)
{
for (int i = k; i >= 1; i--)
for (int j = 0; j < 10; j++)
Board[i][j] = Board[i - 1][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.

19, 10 - магические числа.

Comment thread logic.cpp
Comment on lines +93 to +104
if (!PieceIsBlocked() && !gameover)
CurrentPiece.Y++;
else if (gameover)
{
}
else
{
BlockPiece();
Gameover();
RowFull();
InitPiece();
}

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.

Раз дальше идут скобки, то и в первом блоке сделайте их.

else if (gameover)
{
}

Тело пустое. к чему тогда вообще условие?

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