private int crash(int x, int y, int blockType, int turnState) {
for (int a = 0; a < 4; a++) {
for (int b = 0; b < 4; b++) {
if ((shapes[blockType][turnState][a * 4 + b] &&map[x + b
+ 1][y + a]) == 1) {
return 0;
}
}
}
return 1;
}
////主要是这段if语句的判断搞不懂
if ((shapes[blockType][turnState][a * 4 + b] &&map[x + b
+ 1][y + a]) == 1)
//为什么a要乘以4加b?
因为俄罗斯方块的所有形状,最大长宽是4
一和l是1x4 4x1
z是3x2
T是3x3
方是2x2
所以取最大,也就是4x4可以表示任意图形的任意旋转