I need to solve behavior of four numbers, which will move down or rotate as the meaning of the game Tetris. This is that I want to do on richTextBox in C#, but my code is still not working good. I want to do as illustrated below. How can I do to that numbers are moving in right direction?
0 0 0 0 1 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
after moving down four numbers of "1"
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
or also after rotating clockwise four numbers of "1"
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0
Here is my code.
string[] pole8x8 = new string[400];
string[] pole4x4 = new string[4*2];
List<string> numbers = new List<string>();
int len = 52;
public Form1()
{
InitializeComponent();
for (int i = 0; i < pole8x8.Length; i+=2)
{
pole8x8[i] = "0 ";
richTextBox1.Text += pole8x8[i];
richTextBox1.BackColor = Color.Black;
richTextBox1.ForeColor = Color.White;
}
for (int i = 0; i < pole4x4.Length; i+=2)
{
pole4x4[i] = "1 ";
richTextBox1.SelectionStart = 18;
richTextBox1.SelectedText = pole4x4[i];
numbers.Add(pole4x4[i]);
}
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.SelectionStart += len;
foreach (string s in numbers)
{
richTextBox1.SelectedText = s;
}
}