private void IsiArray() { int[] Fibo = FunctionBase.Fibo(JumlahKolom); int[] Tribo = FunctionBase.Tribo(JumlahKolom); for (int b = 0; b < JumlahBaris; b++) { for (int k = 0; k < JumlahKolom; k++) { if (b == k) { Array2D[b, k] = Fibo[k].ToString(); Array2D[b, JumlahKolom - 1 - k] = Fibo[b].ToString(); } else if (b + k == JumlahBaris - 1) { Array2D[b, k] = Tribo[k].ToString(); Array2D[b, JumlahKolom - 1 - k] = Tribo[b].ToString(); } else if (b >= k && b + k <= JumlahBaris - 1 && b - k != 1 && b + k != JumlahBaris - 2) { Array2D[b, k] = "A"; Array2D[b, JumlahKolom - 1 - k] = "A"; } } } }
private void IsiArray() { int[] Fibo = FunctionBase.Fibo(JumlahBaris * JumlahKolom); int[] Tribo = FunctionBase.Tribo(JumlahBaris * JumlahKolom); int nilai = 0; for (int b = 0; b < JumlahBaris; b++) { int ascii = 65; for (int k = 0; k < JumlahKolom; k++) { if (b + k >= JumlahBaris / 2 && k - b <= JumlahBaris / 2 && b < JumlahBaris / 2) { Array2D[b, k] = Fibo[nilai].ToString(); Array2D[JumlahBaris - 1 - b, k] = Tribo[nilai].ToString(); nilai++; } else if (b == JumlahBaris / 2 && k <= JumlahKolom / 2) { Array2D[b, k] = ((char)ascii).ToString(); Array2D[b, JumlahKolom - 1 - k] = ((char)ascii).ToString(); ascii++; } } } }
private void IsiArray() { for (int b = 0; b < JumlahBaris; b++) { int[] Tribo = FunctionBase.Tribo(JumlahKolom); for (int k = 0; k < JumlahKolom; k++) { Array2D[0, k] = Tribo[k].ToString(); } } }
private void isiArray(int n) { int[] tribo = FunctionBase.Tribo(n * n); for (int bgn = 0; bgn < n; bgn++) { int stBrs = (bgn * bgn + bgn) / 2 + (n - bgn) * bgn; int stKol = bgn * bgn + (n - bgn) * bgn * 2; int angka = 0; int endBrs = stBrs + (n - 1 - bgn); int endKol = stKol + ((n - 1 - 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) { Array2D[b, k] = tribo[angka++].ToString(); } } } } }
private void IsiArray(int n) { int ganjil = 1; int[] Fibo = FunctionBase.Fibo(JumlahBaris * JumlahBaris); int[] Tribo = FunctionBase.Tribo(JumlahBaris * JumlahBaris); int fb = 0; int tb = 0; for (int b = 0; b < JumlahBaris; b++) { for (int k = 0; k < JumlahKolom; k++) { //atas if (b + k >= n * 2 - 1 && k - b <= n * 2 - 1 && b <= n - 1) { Array2D[b, k] = ganjil.ToString(); ganjil += 2; } else if (b - k <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && b >= JumlahBaris - 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[fb++].ToString(); } //kanan else if (k - b <= n * 2 - 1 && b + k <= (n * 2 - 1) + (n * 3) + n - 2 && k >= JumlahKolom - n) { Array2D[b, k] = Tribo[tb++].ToString(); } } } }