private string GetScorePartFromEquationResult(EquationResult e)
    {
        float[] terms = e.GetTerms();
        float   term1 = terms[0];
        float   term2 = terms[1];

        bool   term2IsNegative = term2 < 0;
        string op = term2IsNegative ? "-" : "+";

        return((e.WasCorrect() ? "✓" : "X") + " " + term1 + " " + op + " " + Mathf.Abs(term2) + " = " + e.GetAnswer());
    }
Esempio n. 2
0
    public int GetBaseScore()
    {
        float score = 0;

        for (int i = 0; i < equationsArray.Count; i++)
        {
            EquationResult thisEquation = (EquationResult)equationsArray[i];
            if (thisEquation.WasCorrect())
            {
                float[] terms     = thisEquation.GetTerms();
                float   thisScore = Mathf.Abs(terms[0]) + Mathf.Abs(terms[1]) + Mathf.Abs(thisEquation.GetAnswer());

                score = score + thisScore;
            }
        }

        return((int)Mathf.Ceil(score));
    }