fix(MCU课设): 修复一个方块移动的bug

This commit is contained in:
iridiumR 2022-06-06 17:03:03 +08:00
parent 8c19878cc9
commit 8e4172d69d
2 changed files with 755 additions and 733 deletions

File diff suppressed because it is too large Load diff

View file

@ -163,6 +163,12 @@ void moveLeftPiece()
for(i = 0; i < MAX_X; i++)
for(j = 0; j < MAX_Y; j++)
if(base[i][j] == 2 && !isIegal(i - 1, j))
{
return;
}
for(i = 0; i < MAX_X; i++)
for(j = 0; j < MAX_Y; j++)
if(base[i][j] == 2)
{
base[i - 1][j] = 2;
base[i][j] = 0;
@ -175,7 +181,13 @@ void moveRightPiece()
char i, j;
for(i = MAX_X - 1; i >= 0; i--)
for(j = MAX_Y - 1; j >= 0; j--)
if(base[i][j] == 2 && isIegal(i + 1, j))
if(base[i][j] == 2 && !isIegal(i + 1, j))
{
return;
}
for(i = MAX_X - 1; i >= 0; i--)
for(j = MAX_Y - 1; j >= 0; j--)
if(base[i][j] == 2 )
{
base[i + 1][j] = 2;
base[i][j] = 0;