class num_show { float x; float y; float zene; String[] chat = { "+", "-", "*" }; int zened; int a; int b; int answer; int play; void difficulty(int p) { if (p == 1) { play = 10; } else if (p == 2) { play = 100; } else if (p == 3) { play = 1000; } } void setup() { next(); display(); } int next() { x = random(0, play); y = random(0, play); zene = random(0, 3); zened = int(zene); a = int(x); b = int(y); if (zened == 0) { answer = a+b; } else if (zened == 1) { answer = a-b; } else if (zened == 2) { if(play>=100){ a = a%(play/10); b = b%(play/10); } answer = a*b; } return answer; } void display() { fill(255); rect(50,210,280,55); fill(0); textAlign(CENTER); textSize(30); text(a + chat[zened] + b + "=", 150, 250); } void check(char key) { if (key == ENTER) { if (int(num) == ans) { ans = number.next(); if (stack<6) { stack++; } } num = ""; } else if (key == BACKSPACE) { num = ""; } else { num = num + str(key); } } }