Партнерка на США и Канаду по недвижимости, выплаты в крипто
- 30% recurring commission
- Выплаты в USDT
- Вывод каждую неделю
- Комиссия до 5 лет за каждого referral
private String perevch(int a, int b) {
String str = "";
String str1 = "";
int c = 0;
while (a >= b) {
c = a % b;
if (c < 10) {
str += Integer. toString(c);
} else {
if (c == 10) str += "A";
else if (c == 11) str += "B";
else if (c == 12) str += "C";
else if (c == 13) str += "D";
else if (c == 14) str += "E";
else if (c == 15) str += "F";
}
a /= b;
}
if (a < 10) {
str += Integer. toString(a);
} else {
if (a == 10) str += "A";
else if (a == 11) str += "B";
else if (a == 12) str += "C";
else if (a == 13) str += "D";
else if (a == 14) str += "E";
else if (a == 15) str += "F";
}
for (int i = str. length() - 1; i >= 0; i--) {
str1 += str. charAt(i);
}
return str1;
}
Приложение 2.
Программный код функции заполнения массива цифрами.
Листинг 2.1 – Функция array_bool
private void array_bool(int a) {
ArrayList<String> varchar = new ArrayList<String>();
int x;
int y;
int cons;
String str3 = "";
number++;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
buttons[i][j].setBackgroundResource(R. drawable. button_base);
buttons[i][j].setTextColor(Color. BLACK);
}
for (int i = 0; i < n + 2; i++) {
for (int j = 0; j < m + 2; j++) {
if (i == 0 || i == n + 1 || j == 0 || j == m + 1) b[i][j] = true;
else
b[i][j] = false;
}
}
result = (int) Math. pow(notation, a);
result = (int) (Math. random() * result);
int kolpr = 0;
bin_str = perevch(result, notation);
if (bin_str. length() < a) {
str = "";
for (int i = 0; i < a - bin_str. length(); i++) {
str += "0";
}
str += bin_str;
bin_str = str;
str = "";
}
x = (int) (Math. random() * n);
y = (int) (Math. random() * m);
int kol = 1;
str = "";
txt[0].setText(Integer. toString(result));
for (int i = 0; i < bin_str. length(); i++) {
str += "- ";
}
txt[1].setText(str);
str = "";
str3 += bin_str. charAt(0);
buttons[x][y].setText(str3);
str3 = "";
b[x + 1][y + 1] = true;
while (kol!= bin_str. length()) {
cons = (int) (Math. random() * 4);
if (b[x][y + 1] == true && b[x + 2][y + 1] == true && b[x + 1][y] == true && b[x + 1][y + 2] == true && !stack1.isEmpty()) {
kolpr = 0;
for (int u = stack1.size(); u >= 0; u -= 2) {
x = stack1.get(u - 2);
y = stack1.get(u - 1);
if (b[x][y + 1] == true && b[x + 2][y + 1] == true && b[x + 1][y] == true && b[x + 1][y + 2] == true && !stack1.isEmpty()) {
kolpr += 2;
} else {
u = -1;
}
}
for (int u = 0; u < kolpr; u += 2) {
int x2, y2;
x2 = stack1.get(stack1.size() - 2) + 1;
y2 = stack1.get(stack1.size() - 1) + 1;
b[x2][y2] = false;
buttons[x2 - 1][y2 - 1].setText("");
stack1.remove(stack1.size() - 1);
stack1.remove(stack1.size() - 1);
x = stack1.get(stack1.size() - 2);
y = stack1.get(stack1.size() - 1);
}
kol -= (kolpr / 2);
} else if (cons == 0 && x!= 0 && b[x][y + 1] == false) {
x = x - 1;
str3 += bin_str. charAt(kol);
buttons[x][y].setText(str3);
str3 = "";
b[x + 1][y + 1] = true;
kol = kol + 1;
stack1.add(x);
stack1.add(y);
} else if (cons == 1 && x!= n - 1 && b[x + 2][y + 1] == false) {
x++;
str3 += bin_str. charAt(kol);
buttons[x][y].setText(str3);
str3 = "";
b[x + 1][y + 1] = true;
kol++;
stack1.add(x);
stack1.add(y);
} else if (cons == 2 && y!= 0 && b[x + 1][y] == false) {
y--;
str3 += bin_str. charAt(kol);
buttons[x][y].setText(str3);
str3 = "";
b[x + 1][y + 1] = true;
kol++;
stack1.add(x);
stack1.add(y);
} else if (cons == 3 && y!= m - 1 && b[x + 1][y + 2] == false) {
y++;
str3 += bin_str. charAt(kol);
buttons[x][y].setText(str3);
str3 = "";
b[x + 1][y + 1] = true;
kol++;
stack1.add(x);
stack1.add(y);
}
//}
}
varchar. add("0");
varchar. add("1");
varchar. add("2");
varchar. add("3");
varchar. add("4");
varchar. add("5");
varchar. add("6");
varchar. add("7");
varchar. add("8");
varchar. add("9");
varchar. add("A");
varchar. add("B");
varchar. add("C");
varchar. add("D");
varchar. add("E");
varchar. add("F");
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (b[i + 1][j + 1] == false) {
b[i + 1][j + 1] = true;
x = (int) (Math. random() * notation);
for (int h = 0; h < notation; h++) {
if (h == x) {
buttons[i][j].setText(varchar. get(h));
}
}
}
}
}
Приложение 3.
Программный код функции btnclick.
Листинг 3.1 – Функция btnclick
private void btnclick(int i, int j) {
//txt[4].setText(bin_str);
if (b[i + 1][j + 1]) {
String str1 = txt[1].getText().toString(), str2 = "";
if (stack2.isEmpty()) {
stack2.add(i);
stack2.add(j);
b[i + 1][j + 1] = false;
buttons[i][j].setBackgroundResource(R. drawable. fon);
buttons[i][j].setTextColor(Color. WHITE);
str += buttons[i][j].getText();
for (int h = 0; h < str. length(); h++) {
str2 += str. charAt(h) + " ";
}
for (int h = 0; h < category - str. length(); h++) {
str2 += "- ";
}
txt[1].setText(str2);
str2 = "";
} else {
if (provcoordinate(i, j)) {
stack2.add(i);
stack2.add(j);
b[i + 1][j + 1] = false;
buttons[i][j].setBackgroundResource(R. drawable. fon);
buttons[i][j].setTextColor(Color. WHITE);
str += buttons[i][j].getText();
str2 = "";
for (int h = 0; h < str. length(); h++) {
str2 += str. charAt(h) + " ";
}
for (int h = 0; h < category - str. length(); h++) {
str2 += "- ";
}
txt[1].setText(str2);
str2 = "";
if (str. equals(bin_str)) {
score += Integer. parseInt(bin_str, notation);
txt[3].setText(Integer. toString(score));
Toast. makeText(this, "Next", Toast. LENGTH_SHORT).show();
//txt[2].setText("0");
stack2.clear();
if (number % 5 == 0)
category++;
for (int e = 0; e < n + 2; e++)
for (int w = 0; w < m + 2; w++)
b[e][w] = true;
for (int e = 0; e < n; e++)
for (int w = 0; w < m; w++)
buttons[e][w].setText("");
counttim = Integer. parseInt(txt1[2].getText().toString() + "000") + 5000;
tim. cancel();
txt1[2].setText("");
tim = new CountDownTimer(counttim, 1000) {
public void onTick(long millisUntilFinished) {
txt1[2].setText("" + (millisUntilFinished / 1000));
}
public void onFinish() {
Context context = Activity_notation. this;
txt1[2].setText("0");
String title = "Выберите дальнейшее действие";
String btnstr1 = "";
String btnstr2 = "Начать заново";
ad = new AlertDialog. Builder(context);
ad. setTitle(title);
ad. setPositiveButton(btnstr1, new DialogInterface. OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
strvib = "time";
perehod();
}
}).setNegativeButton(btnstr2, new DialogInterface. OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
strvib = "alert";
perehod();
}
});
ad. setCancelable(true);
ad. setOnCancelListener(new DialogInterface. OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
strvib = "exit";
}
});
ad. show();
}
};
tim. start();
array_bool(category);
} else {
if (str. length() == bin_str. length()) {
score -= (Integer. parseInt(bin_str, notation) / 2);
txt[3].setText(Integer. toString(score));
for (int e = 0; e < n; e++)
for (int w = 0; w < m; w++) {
buttons[e][w].setBackgroundResource(R. drawable. button_base);
buttons[e][w].setTextColor(Color. BLACK);
}
for (int e = 0; e < n + 2; e++)
for (int w = 0; w < m + 2; w++)
b[e][w] = true;
str = "";
for (int e = 0; e < category; e++) {
str += "- ";
}
stack2.clear();
txt[1].setText(str);
str = "";
Toast. makeText(this, "Wrong", Toast. LENGTH_SHORT).show();
}
}
}
}
} else {
if (i == stack2.get(stack2.size() - 2) && j == stack2.get(stack2.size() - 1)) {
String str1 = txt[1].getText().toString(), str2 = "";
buttons[i][j].setBackgroundResource(R. drawable. button_base);
buttons[i][j].setTextColor(Color. BLACK);
b[i + 1][j + 1] = true;
stack2.remove(stack2.size() - 1);
stack2.remove(stack2.size() - 1);
int pr = 0;
str2 = "";
for (int h = 0; h < str. length() - 1; h++) str2 += str. charAt(h);
str = str2;
str2 = "";
for (int h = 0; h < str. length(); h++) {
str2 += str. charAt(h) + " ";
}
for (int h = 0; h < category - str. length(); h++) {
str2 += "- ";
}
txt[1].setText(str2);
}
}
}
|
Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 |


