Exemplo n.º 1
0
 private void IsiArray()
 {
     for (int k = 0; k < JmlhKolom; k++)
     {
         int[] Fibo = FunctionBase.FibonacciSoal02(JmlhKolom);
         {
             Array2D[0, k] = Fibo[k].ToString();
         }
     }
 }
Exemplo n.º 2
0
 private void isiArray(int n)
 {
     int[] tribo = FunctionBase.FibonacciSoal02(n * n);
     for (int bangun = 0; bangun < n; bangun++)
     {
         int StrBaris = (bangun * bangun + bangun) / 2 + (n - bangun) * bangun;
         int StrKolom = bangun * bangun + (n - bangun) * bangun * 2;
         int angka    = 0;
         int EndBaris = StrBaris + (n - 1 - bangun);
         int EndKolom = StrKolom + ((n - 1 - bangun) * 2);
         for (int b = StrBaris; b <= EndBaris; b++)
         {
             for (int k = StrKolom; k <= EndKolom; k++)
             {
                 if (b + k >= StrKolom + EndBaris && k + EndBaris <= b + EndKolom)
                 {
                     Array2D[b, k] = tribo[angka++].ToString();
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        private void IsiArray(int n)
        {
            int[] fibo   = FunctionBase.FibonacciSoal01(JmlhKolom * JmlhKolom);
            int[] tribo  = FunctionBase.FibonacciSoal02(JmlhKolom * JmlhKolom);
            int   angka  = 1;
            int   index1 = 0;
            int   index2 = 0;

            for (int b = 0; b < JmlhBaris; b++)
            {
                for (int k = 0; k < JmlhKolom; k++)
                {
                    //segitiga atas
                    if (b + k >= n * 2 - 1 && k - b <= n * 2 - 1 && b <= n - 1)
                    {
                        Array2D[b, k] = angka.ToString();
                        angka        += 2;
                    }
                    //segitiga kiri
                    if (b + k >= n * 2 - 1 && b - k <= n * 2 - 1 && k <= n - 1)
                    {
                        Array2D[b, k] = fibo[index1++].ToString();
                    }
                    //segitiga bawah
                    if (b - k <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && b >= JmlhBaris - n)
                    {
                        Array2D[b, k] = angka.ToString();
                        angka        += 2;
                    }
                    if (k - b <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && k >= JmlhKolom - n)
                    {
                        Array2D[b, k] = tribo[index2++].ToString();
                    }
                }
            }
        }