int y) {coord [index, 1] = y;} tmoveCoord (int id, string d, int c = 1)
{(int i = 0; i
{(d)
{"Left":
tcoord [id, 0] = tcoord [id, 0] - 1; break; "Right":
tcoord [id, 0] = tcoord [id, 0] + 1; break; "Up":
tcoord [id, 1] = tcoord [id, 1] - 1; break; "Down":
tcoord [id, 1] = tcoord [id, 1] + 1; break;
}
}
} setCoord (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
coord [0, 0] = x1;
coord [0, 1] = y1;
coord [1, 0] = x2;
coord [1, 1] = y2;
coord [2, 0] = x3;
coord [2, 1] = y3;
coord [3, 0] = x4;
coord [3, 1] = y4;
} copy (int [,] m1, int [,] m2)
{(int i = 0; i <4; i + +)
{(int j = 0; j <2; j + +)
{
m1 [i, j] = m2 [i, j];
}
}
} checkCoord (int [,] m)
{(int i = 0; i <4; i + +)
{(m [i, 0] <0 | | m [i, 0]> 9); (m [i, 1] <0 | | m [i, 1] > 18); (MainWindow.table [m [i, 0], m [i, 1]] == true)
{f = false; (int i_ = 0; i_ <4; i_ + +)
{(m [i, 0] == coord [i_, 0] && m [i, 1] == coord [i_, 1])
f = true;
} (! f);
}
}; rotate_left ()
{(lastShape == 1);
copy (tcoord, coord);
(lastShape)
{2:// палиця (state == 1)
{
tmoveCoord (2, "Down");
tmoveCoord (2, "Left");
tmoveCoord (1, "Down", 2);
tmoveCoord (1, "Right");
tmoveCoord (0, "Down", 3);
tmoveCoord (0, "Right", 2); (! checkCoord (tcoord));
remove ();
state = 2;
copy (coord, tcoord);
} (state == 2)
{
tmoveCoord (2, "Up");
tmoveCoord (2, "Right");
tmoveCoord (1, "Up", 2);
tmoveCoord (1, "Left");
tmoveCoord (0, "Up", 3);
tmoveCoord (0, "Left", 2); (! checkCoord (tcoord));
remove ();
state = 1;
copy (coord, tcoord);