ify"> x = coord [i, 0];
y = coord [i, 1];. table [x, y] = false;
}
} clear ()
{(int i = 0; i <4; i + +)
{
coord [i, 0] = coord [i, 1] = 0;
}
lastShape = count = nextShape = 0;
} toTable ()
{(int i = 0; i <4; i + +). table [coord [i, 0], coord [i, 1]] = true;
} RandomShape ()
{rand = newRandom (); type = 0;
{
type = rand.Next (1, 7); (type == lastShape)
{
count + +; (count <4);
};
} while (true); type;
} createShape (int type)
{(type)
{1:// квадрат
setCoord (4, 0, 4, 1, 5, 0, 5, 1); break; 2:// палиця
setCoord (5, 0, 5, 1, 5, 2, 5, 3); break; 3:// _ | _
setCoord (5, 0, 5, 1, 4, 1, 6, 1); break; 4:// | _
setCoord (4, 0, 4, 1, 4, 2, 5, 2); break; 5:// _ |
setCoord (5, 0, 5, 1, 5, 2, 4, 2); break; 6:// ліва
setCoord (5, 0, 5, 1, 4, 1, 4, 2); break; 7:// права
setCoord (4, 0, 4, 1, 5, 1, 5, 2); break;
}
state = 1;
lastShape = type;. Inv ();
}
}
}
КлассBuild - відповідає за ігровий процес гри
{
{Level = 0; Score = 0; mode = 1; Shapes = 0; LinesRemoved = 0; speed = 600; space = false; isPaused = false; thr = null; Start (int m)
{
ClearTable ();
Level = 1;
Score = 0;
Shapes = 0;
mode = m; = newThread (newThreadStart (tableProc));
thr.Start ();
} tableProc ()
{. nextShape = Shape.RandomShape (); (;;)
{. createShape (Shape.nextShape);. nextShape = Shape.RandomShape ();. MF.nextPaint = true; + +; (mode)
{1: (Shapes% 60 == 0)
{
Level + +;
speed - = 50;. MF.setLevel (Level);
}; 2: (Shapes% 30 == 0)
{
Level + +;
speed - = 50;. MF.setLevel (Level);
}; 3: (Shapes% 20 == 0)
{
Level + +;
speed - = 50;. MF.setLevel (Level);