Ejemplo n.º 1
0
        private void R_matr_print(int[] in_el_ar)
        {
            int    i, c = 0;
            string buf = "";

            for (i = in_el_ar.Length - 1; i > 0; i--)
            {
                if (in_el_ar[i] == 0)
                {
                    c++;
                }
                else
                {
                    break;
                }
            }
            c            = in_el_ar.Length - c;
            int[,] r_buf = new int[c, c];
            for (i = 0; i < c; i++)
            {
                if (in_el_ar[i] != 0)
                {
                    rd.Text = rd2.Text += "D" + in_el_ar[i].ToString() + "\n";
                    for (int j = 0; j < c; j++)
                    {
                        if (in_el_ar[j] != 0)
                        {
                            buf += r_matr[in_el_ar[i] - 1, in_el_ar[j] - 1] + "   ";
                        }
                    }
                    R_tb.AppendText(buf.TrimEnd() + "\n");
                    buf = "";
                }
            }
        }
Ejemplo n.º 2
0
        private void demo_set()
        {
            el_array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
            int c = 0;

            for (int i = 0; i < el_array.Length; i++)
            {
                if (el_array[i] != 0)
                {
                    pos_visible(c, el_array[i]);
                    drp_matr[pos_matr[0, c], pos_matr[1, c]] = el_array[i];
                }
                else
                {
                    drp_matr[pos_matr[0, c], pos_matr[1, c]] = el_array[i];
                }
                c++;
            }

            d_matr = new int[el_array.Length, el_array.Length];
            r_matr = new int[, ] {
                { 0, 0, 6, 0, 0, 3, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0 },
                { 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 1, 0, 3, 0, 0, 0 },
                { 6, 0, 0, 0, 0, 6, 6, 0, 0, 0, 3, 0, 0, 0, 3, 0 },
                { 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 1 },
                { 0, 0, 0, 0, 0, 1, 1, 1, 6, 6, 0, 3, 0, 0, 0, 0 },
                { 3, 0, 6, 0, 1, 0, 0, 0, 1, 1, 2, 2, 0, 4, 5, 0 },
                { 3, 0, 6, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 3, 0, 3 },
                { 0, 3, 0, 6, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 5, 1 },
                { 0, 0, 0, 0, 6, 1, 1, 1, 0, 6, 2, 1, 3, 0, 0, 2 },
                { 0, 0, 0, 0, 6, 1, 1, 1, 6, 0, 0, 0, 0, 0, 1, 1 },
                { 0, 1, 3, 0, 0, 2, 0, 0, 2, 0, 0, 1, 2, 0, 0, 2 },
                { 3, 0, 0, 0, 3, 2, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
                { 0, 3, 0, 0, 0, 0, 1, 0, 3, 0, 2, 1, 0, 2, 4, 1 },
                { 0, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 0, 2, 0, 0, 1 },
                { 0, 0, 3, 6, 0, 5, 0, 5, 0, 1, 0, 1, 4, 0, 0, 0 },
                { 0, 0, 0, 1, 0, 0, 3, 1, 2, 1, 2, 0, 1, 1, 0, 0 }
            };
            string probel = "   ", str = "";

            rd.Text = rd2.Text = R_tb.Text = "";
            dr.Text = dr2.Text = D_tb.Text = "";
            for (int i = 0; i < positions.GetLength(1); i++)
            {
                if (i == 15)
                {
                    rd.AppendText("D" + positions[0, i].ToString());
                    rd2.AppendText("D" + positions[0, i].ToString());
                }
                else
                {
                    rd.AppendText("D" + positions[0, i].ToString() + "\n");
                    rd2.AppendText("D" + positions[0, i].ToString() + "\n");
                }
            }
            for (int i = 0; i < r_matr.GetLength(0); i++)
            {
                for (int j = 0; j < r_matr.GetLength(1); j++)
                {
                    str += r_matr[i, j].ToString() + probel;
                }
                if (i != 15)
                {
                    R_tb.AppendText(str + "\n");
                }
                else
                {
                    R_tb.AppendText(str);
                }
                str = "";
            }
        }