void CurrentMode() { if (currentMode == 1) { mathsType = MathsType.addition; } else if (currentMode == 2) { mathsType = MathsType.subtraction; } else if (currentMode == 3) { mathsType = MathsType.multiplication; } }
//at start we need to do few basic setups public void init() { canPlay = true; //we put the location value in tag of button variable tagOfButton = locationOfAnswer.ToString(); //at start the mileSton value is equal to mile stone count scoreMileStone = scoreMileStoneCount; //get the time value GameManager.singleton.timeForQuestion = timeForQuestion; //we call the methods mathsType = MathsType.mix; MathsProblem(); }
//this method keeps the track of mode void CurrentMode() { if (currentMode == 1) { //depending on the currentmode value we assign the mode mathsType = MathsType.addition; } else if (currentMode == 2) { mathsType = MathsType.subtraction; } else if (currentMode == 3) { mathsType = MathsType.multiplication; } else if (currentMode == 4) { mathsType = MathsType.division; } else if (currentMode == 5) { mathsType = MathsType.mix; } }
public static KeyValuePair <string, double>?DoSomeMaths(int a, int b, MathsType type) { if (type == MathsType.Type1) { var r = 0.0d; var s = "Starting"; r = a + 2; s += "\nAdded 2 to a"; r += b; s += "\nAdded b to result"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r = Math.Round(r, 2); s += "\nRounded to 2 decimals"; var rv = new KeyValuePair <string, double>(s, r); return(rv); } else if (type == MathsType.Type2) { var r = 0.0d; var s = "Starting"; r = a + 2; s += "\nAdded 2 to a"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r += b; s += "\nAdded b to result"; r = Math.Round(r, 2); s += "\nRounded to 2 decimals"; var rv = new KeyValuePair <string, double>(s, r); return(rv); } else if (type == MathsType.Type3) { var r = 0.0d; var s = "Starting"; r = a + 2; s += "\nAdded 2 to a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r = Math.Round(r, 2); s += "\nRounded to 2 decimals"; var rv = new KeyValuePair <string, double>(s, r); return(rv); } else if (type == MathsType.Type4) { var r = 0.0d; var s = "Starting"; r = a + 2; s += "\nAdded 2 to a"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r += b; s += "\nAdded b to result"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r += b; s += "\nAdded b to result"; r += b; s += "\nAdded b to result"; r /= a - .5 * b; s += "\nDivided the result by the difference of a and half of b"; r *= 4 - a; s += "\nMultiplied the result by 4 minus a"; r = Math.Round(r, 2); s += "\nRounded to 2 decimals"; var rv = new KeyValuePair <string, double>(s, r); return(rv); } return(null); }