void pemdasProblem(int difficulty) { Text input = inputObject.GetComponent(); switch (difficulty) { /* there is unshown code but it follows the same logic */ // level III is PEMDAS problems case 3: // 33% of being (a[]b)²[]c[]d if (UnityEngine.Random.Range(0,101) > 67) { // 50% chance of being multiplication if (UnityEngine.Random.Range(0,101) > 50) { a = UnityEngine.Random.Range(0,13); b = UnityEngine.Random.Range(0,13); c = UnityEngine.Random.Range(0,13); d = UnityEngine.Random.Range(0,13); // 50% chance of being (a[]b)²(c)[]d if(UnityEngine.Random.Range(0,101) > 50){ // 50% chance of being (a+b)²(c)[]d if(UnityEngine.Random.Range(0,101)>50){ // 50% of being (a+b)²(c)+d if(UnityEngine.Random.Range(0,101)>50){ ans = ((int) Mathf.Pow((float) a+ (float) b, 2))*c+d; input.text = "("+a+"+"+b+")"+"²"+"("+c+")"+"+"+d+"="; Debug.Log("Problem ID: 78"); // 50% of being (a+b)²(c)-d } else { ans = ((int) Mathf.Pow((float) a+ (float) b, 2))*c-d; input.text = "("+a+"+"+b+")"+"²"+"("+c+")"+"-"+d+"="; Debug.Log("Problem ID: 79"); } // 50% of being (a-b)²(c)[]d } else { // 50% of being (a-b)²(c)+d if(UnityEngine.Random.Range(0,101)>50){ ans = ((int) Mathf.Pow((float) a- (float) b, 2))*c+d; input.text = "("+a+"-"+b+")"+"²"+"("+c+")"+"+"+d+"="; Debug.Log("Problem ID: 80"); // 50% of being (a-b)²(c)-d } else { ans = ((int) Mathf.Pow((float) a- (float) b, 2))*c-d; input.text = "("+a+"-"+b+")"+"²"+"("+c+")"+"-"+d+"="; Debug.Log("Problem ID: 81"); } } // 50% chance of being (a[]b)²c[]*d } else { // 50% chance of being (a+b)²[]c(d) if(UnityEngine.Random.Range(0,101)>50){ // 50% of being (a+b)²+c(d) if(UnityEngine.Random.Range(0,101)>50){ ans = ((int) Mathf.Pow((float) a+ (float) b, 2))+c*d; input.text = "("+a+"+"+b+")"+"²"+"+"+c+"("+d+")"+"="; Debug.Log("Problem ID: 82"); // 50% of being (a+b)²-c(d) } else { ans = ((int) Mathf.Pow((float) a+ (float) b, 2))-c*d; input.text = "("+a+"+"+b+")"+"²"+"-"+c+"("+d+")"+"="; Debug.Log("Problem ID: 83"); } // 50% of being (a-b)²[]c(d) } else { // 50% of being (a-b)²+c(d) if(UnityEngine.Random.Range(0,101)>50){ ans = ((int) Mathf.Pow((float) a- (float) b, 2))+c*d; input.text = "("+a+"-"+b+")"+"²"+"+"+c+"("+d+")"+"="; Debug.Log("Problem ID: 84"); // 50% of being (a-b)²-c(d) } else { ans = ((int) Mathf.Pow((float) a- (float) b, 2))-c*d; input.text = "("+a+"-"+b+")"+"²"+"-"+c+"("+d+")"+"="; Debug.Log("Problem ID: 85"); } } } //50% of being division } else { a = UnityEngine.Random.Range(0,13); b = UnityEngine.Random.Range(0,13); c = UnityEngine.Random.Range(0,13); d = UnityEngine.Random.Range(0,13); // 50% chance of being (a[]b)²/(c)[]d if(UnityEngine.Random.Range(0,101) > 50){ // 50% chance of being (a+b)²/(c)[]d if(UnityEngine.Random.Range(0,101)>50){ // 50% of being (a+b)²/(c)+d if(UnityEngine.Random.Range(0,101)>50){ divisionQuickLoop(14); ans = ((int) Mathf.Pow((float) a+ (float) b, 2))/c+d; input.text = "("+a+"+"+b+")"+"²"+"/"+"("+c+")"+"+"+d+"="; Debug.Log("Problem ID: 86"); // 50% of being (a+b)²/(c)-d } else { divisionQuickLoop(14); ans = ((int) Mathf.Pow((float) a+ (float) b, 2))*c-d; input.text = "("+a+"+"+b+")"+"²"+"/"+"("+c+")"+"-"+d+"="; Debug.Log("Problem ID: 87"); } // 50% of being (a-b)²/(c)[]d } else { // 50% of being (a-b)²/(c)+d if(UnityEngine.Random.Range(0,101)>50){ divisionQuickLoop(15); ans = ((int) Mathf.Pow((float) a- (float) b, 2))/c+d; input.text = "("+a+"-"+b+")"+"²"+"/"+"("+c+")"+"+"+d+"="; Debug.Log("Problem ID: 88"); // 50% of being (a-b)²/(c)-d } else { divisionQuickLoop(15); ans = ((int) Mathf.Pow((float) a- (float) b, 2))/c-d; input.text = "("+a+"-"+b+")"+"²"+"/"+"("+c+")"+"-"+d+"="; Debug.Log("Problem ID: 89"); } } // 50% chance of being (a[]b)²[]c/(d) } else { // 50% chance of being (a+b)²[]c/(d) if(UnityEngine.Random.Range(0,101)>50){ // 50% of being (a+b)²+c/(d) if(UnityEngine.Random.Range(0,101)>50){ divisionQuickLoop(3); ans = ((int) Mathf.Pow((float) a+ (float) b, 2))+c/d; input.text = "("+a+"+"+b+")"+"²"+"+"+c+"/"+"("+d+")"+"="; Debug.Log("Problem ID: 90"); // 50% of being (a+b)²-c/(d) } else { divisionQuickLoop(3); ans = ((int) Mathf.Pow((float) a+ (float) b, 2))-c/d; input.text = "("+a+"+"+b+")"+"²"+"-"+c+"/"+"("+d+")"+"="; Debug.Log("Problem ID: 91"); } // 50% of being (a-b)²[]c/(d) } else { // 50% of being (a-b)²+c/(d) if(UnityEngine.Random.Range(0,101)>50){ divisionQuickLoop(3); ans = ((int) Mathf.Pow((float) a- (float) b, 2))+c/d; input.text = "("+a+"-"+b+")"+"²"+"+"+c+"/"+"("+d+")"+"="; Debug.Log("Problem ID: 92"); // 50% of being (a-b)²-c/(d) } else { divisionQuickLoop(3); ans = ((int) Mathf.Pow((float) a+ (float) b, 2))-c/d; input.text = "("+a+"-"+b+")"+"²"+"-"+c+"/"+"("+d+")"+"="; Debug.Log("Problem ID: 93"); } } } } } // 33% of being a[](b[]c)²[]d else if (UnityEngine.Random.Range(0,101) > 33) { // code not shown } // 33% of being a[]b[](c[]d)² else { //code not show } break; } }