private void isiArray(int n) { int[] fibo = FunctionBase.Fibonacci(n * n); int[] tribo = FunctionBase.Tribonacci(n * n); int angka = 0; int ascii = 65; for (int b = 0; b < JmlBaris; b++) { for (int k = 0; k < JmlKolom; k++) { if (b == JmlBaris / 2) { Array2D[b, k] = ((char)ascii).ToString(); if (k < JmlBaris / 2) { ascii++; } else { ascii--; } angka = 0; } else if (b + k >= JmlBaris / 2 && k - b <= JmlBaris / 2 && b < JmlBaris / 2) { Array2D[b, k] = fibo[angka++].ToString(); } else if (b - k <= JmlBaris / 2 && b + k <= JmlKolom / 2 + JmlKolom - 1 && b > JmlBaris / 2) { Array2D[b, k] = tribo[angka++].ToString(); } } } }
private void IsiArray(int n) { for (int bgn = 0; bgn < n; bgn++) { int[] fibo = FunctionBase.Fibonacci(n * n); int[] tribo = FunctionBase.Tribonacci(n * n); int angka = 0; int stBrs = n * (bgn % 2); int stKol = (n * 2 - 1) * bgn; int endBrs = stBrs + n - 1; int endKol = stKol + (n * 2 - 1) - 1; for (int b = stBrs; b <= endBrs; b++) { for (int k = stKol; k <= endKol; k++) { if (b + k >= stKol + endBrs && k + endBrs <= b + endKol && bgn % 2 == 0) { Array2D[b, k] = fibo[angka++].ToString(); } else if ((b - stBrs) <= (k - stKol) && (b - stBrs) + (k - stKol) <= endKol - stKol && bgn % 2 == 1) { Array2D[b, k] = tribo[angka++].ToString(); } } } } }
private void IsiArray(int n) { int[] fibo = FunctionBase.Fibonacci(n * n * 2); int[] tribo = FunctionBase.Tribonacci(n * n * 2); int fb = 0; int tb = 0; for (int bgn = 0; bgn < n; bgn++) { int stBrs = jmlBaris - 1 - (bgn * bgn + bgn) / 2 - bgn; int stKol = jmlKolom - 1 - (bgn * bgn) - bgn * 2; int endBrs = stBrs + bgn; int endKol = stKol + bgn * 2; for (int b = stBrs; b <= endBrs; b++) { for (int k = stKol; k <= endKol; k++) { if (b - stBrs <= k - stKol && (b - stBrs) + (k - stKol) <= endKol - stKol) { Array2D[b, k] = bgn % 2 == 0 ? tribo[tb++].ToString() : fibo[fb++].ToString(); } } } } }
private void isiArray(int n) { int[] fibo = FunctionBase.Fibonacci(JmlKolom); int[] tribo = FunctionBase.Tribonacci(JmlKolom); int angka1 = 1; int angka2 = 1; for (int b = 0; b < JmlBaris; b++) { for (int k = 0; k < JmlKolom; k++) { if (b == k) { Array2D[b, k] = fibo[b].ToString(); Array2D[b, JmlKolom - 1 - k] = fibo[b].ToString(); } else if (b + k == JmlBaris - 1) { Array2D[b, k] = tribo[k].ToString(); Array2D[b, JmlKolom - 1 - k] = tribo[k].ToString(); } else if (b >= k && b + k <= JmlBaris - 1 && b - k != 1 && b + k != JmlBaris - 2) { Array2D[b, k] = "A"; Array2D[b, JmlKolom - 1 - k] = "A"; } } } }
private void isiArray(int n) { int[] fibo = FunctionBase.Fibonacci(JmlKolom * n); int[] tribo = FunctionBase.Tribonacci(JmlKolom * n); int angka1 = 0; int angka2 = 0; for (int bgn = 0; bgn < n; bgn++) { int stBrs = (bgn * bgn + bgn) / 2; int stKol = ((n * 2 - 1) / 2) - bgn; int endBrs = stBrs + bgn; int endkol = stKol + (bgn * 2); for (int b = stBrs; b <= endBrs; b++) { for (int k = stKol; k <= endkol; k++) { if (b + k == stKol + endBrs || k + endBrs == b + endkol || b == endBrs) { if (bgn % 2 == 0) { Array2D[b, k] = fibo[angka1++].ToString(); } else { Array2D[b, k] = tribo[angka2++].ToString(); } } } } } }
private void IsiArray(int n) { int[] fibo = FunctionBase.Fibonacci(n * n * 2); int[] tribo = FunctionBase.Tribonacci(n * n * 2); int tb = 0; int fb = 0; for (int bgn = 0; bgn < n; bgn++) { int stBrs = n * bgn; int stKol = bgn % 2 * (n * 2 - 1); int endBrs = stBrs + (n - 1); int endKol = stKol + 2 * (n - 1); for (int b = stBrs; b <= endBrs; b++) { for (int k = stKol; k <= endKol; k++) { if (b + k >= stKol + endBrs && k + endBrs <= b + endKol) { Array2D[b, k] = fibo[fb++].ToString(); } else if (b + k >= stKol + endBrs && k + endBrs <= b + endKol) { Array2D[b, k] = tribo[tb++].ToString(); } } } } }
private void isiArray() { int[] tribo = FunctionBase.Tribonacci(JmlKolom); for (int k = 0; k < JmlKolom; k++) { Array2D[0, k] = tribo[k].ToString(); } }
private void IsiArray(int n) { int ganjil = 1; int[] fibo = FunctionBase.Fibonacci(jmlKolom * jmlBaris); int[] tribo = FunctionBase.Tribonacci(jmlKolom * jmlBaris); int index1 = 0; int index2 = 0; for (int b = 0; b < jmlBaris; b++) { for (int k = 0; k < jmlKolom; k++) { //atas if (b + k >= n * 2 - 1 && k - b <= n * 2 - 1 && b <= n - 1) { Array2D[b, k] = ganjil.ToString(); ganjil += 2; } //bawah else if (b - k <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && b >= jmlBaris - n) { Array2D[b, k] = ganjil.ToString(); ganjil += 2; } //kiri else if (b + k >= n * 2 - 1 && b - k <= n * 2 - 1 && k <= n - 1) { Array2D[b, k] = fibo[index1++].ToString(); } //kanan else if (k - b <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && k >= jmlKolom - n) { Array2D[b, k] = tribo[index2++].ToString(); } else if (b == jmlBaris / 2 || k == jmlKolom / 2) { Array2D[b, k] = "X"; } } } }
private void isiArray(int n) { int[] tibo = FunctionBase.Tribonacci(n * n); for (int bgn = 0; bgn < n; bgn++) { int sBrs = (bgn * bgn + bgn) / 2 + (n - bgn) * bgn; int sKol = bgn * bgn + (n - bgn) * bgn * 2; int angka = 0; int eBrs = sBrs + (n - 1 - bgn); int eKol = sKol + ((n - 1 - bgn) * 2); for (int b = sBrs; b <= eBrs; b++) { for (int k = sKol; k <= eKol; k++) { if (b + k >= sKol + eBrs && k + eBrs <= b + eKol) { Array2d[b, k] = tibo[angka++].ToString(); } } } } }
private void isiArray(int n) { int[] fibo = FunctionBase.Fibonacci(n * n); int[] tribo = FunctionBase.Tribonacci(n * n); int fb = 0; int tb = 0; int ganjil = 1; for (int b = 0; b < JmlBaris; b++) { for (int k = 0; k < JmlKolom; k++) { //atas if (b + k >= n * 2 - 1 && k - b <= n * 2 - 1 & b <= n - 1 || b - k <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && b >= JmlBaris - n) { Array2D[b, k] = ganjil.ToString(); ganjil += 2; } //bawah //else if (b - k <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && b >= JmlBaris - n) //{ // Array2D[b, k] = "B"; //} //kiri else if (b + k >= n * 2 - 1 && b - k <= n * 2 - 1 && k <= n - 1) { Array2D[b, k] = fibo[fb++].ToString(); } else if (k - b <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && k >= JmlKolom - n) { Array2D[b, k] = tribo[tb++].ToString(); } } } }