private void AddToFirstList(int[][] table, ListBox listBox) { int[] P1 = Algorithm.countP1(table), P2 = Algorithm.countP2(table), lambda = Algorithm.countLambda(P1, P2); int[][] D1 = Algorithm.countD1(table, lambda), D0 = Algorithm.countD0(table, lambda), D2 = Algorithm.countD2(table, lambda); int[][] sequences = { Algorithm.rule1(P1, P2, Algorithm.merge(D0, D1), D2, table), Algorithm.rule2(lambda), Algorithm.rule3(P1, P2, D0, D1, D2, table), Algorithm.rule4(P1, P2, lambda, D0, D1, D2, table) }; listBox.Items.Clear(); listBox.Items.Add(Gran(spaces - 2, spaces, table[0].Length + 8)); string str = ""; str += "|" + "di" + Spaсes(spaces - "di".Length - 2) + "|"; for (int i = 0; i < table[0].Length; i++) { str += "S" + (i + 1).ToString() + Spaсes(spaces - 1 - (i + 1).ToString().Length) + "|"; } str += "Pi1" + Spaсes(spaces - 3) + "|"; str += "Pi2" + Spaсes(spaces - 3) + "|"; str += "Li" + Spaсes(spaces - 2) + "|"; str += "sq1" + Spaсes(spaces - 3) + "|"; str += "sq2" + Spaсes(spaces - 3) + "|"; str += "sq3" + Spaсes(spaces - 3) + "|"; str += "sq4" + Spaсes(spaces - 3) + "|"; listBox.Items.Add(str); listBox.Items.Add(Gran(spaces - 2, spaces, table[0].Length + 8)); for (int i = 0; i < table.Length; i++) { str = ""; str += "|" + (i + 1).ToString() + Spaсes(spaces - (i + 1).ToString().Length - 2) + "|"; for (int j = 0; j < table[0].Length; j++) { str += table[i][j].ToString() + Spaсes(spaces - table[i][j].ToString().Length) + "|"; } str += P1[i].ToString() + Spaсes(spaces - P1[i].ToString().Length) + "|"; str += P2[i].ToString() + Spaсes(spaces - P2[i].ToString().Length) + "|"; str += lambda[i].ToString() + Spaсes(spaces - lambda[i].ToString().Length) + "|"; str += (sequences[0][i] + 1).ToString() + Spaсes(spaces - sequences[0][i].ToString().Length) + "|"; str += (sequences[1][i] + 1).ToString() + Spaсes(spaces - sequences[1][i].ToString().Length) + "|"; str += (sequences[2][i] + 1).ToString() + Spaсes(spaces - sequences[2][i].ToString().Length) + "|"; str += (sequences[3][i] + 1).ToString() + Spaсes(spaces - sequences[3][i].ToString().Length) + "|"; listBox.Items.Add(str); } listBox.Items.Add(Gran(spaces - 2, spaces, table[0].Length + 8)); }