Exemplo n.º 1
0
    public void unsubstitute(Eq eqbefore, Eq eqafter)
    {
        string prevEq = currentEquation.print();

        eqafter         = eqafter.substitute(new Eq("★"), substitutions);
        eqafter         = eqafter.substitute(new Eq("◎"), substitutionc);
        currentEquation = currentEquation.substitute(eqbefore, eqafter);
        if (!prevEq.Equals(currentEquation.print()))
        {
            currentEquation     = currentEquation.substitute(new Eq("◎"), new Eq("★"));
            substitutions       = substitutionc;
            starAvailable       = true;
            currentFormula.text = currentEquation.print();
            fullFormula.text   += "\n" + currentEquation.print();
            if (yexist)
            {
                if (eqbefore.print().Contains("x") || eqbefore.print().Contains("y"))
                {
                    if (currentEquation.find(answer))
                    {
                        pm.ProbSolved();
                        pm.transGlow.SetActive(false);
                        for (int i = 0; i < 5; i++)
                        {
                            PracTranss[i].GetComponent <PracTrans>().eq = new Eq("");
                            PracTranss[i].GetComponent <PracTrans>().setEq();
                        }
                    }
                }
            }
            else if (currentEquation.find(answer))
            {
                pm.ProbSolved();
                pm.transGlow.SetActive(false);
                for (int i = 0; i < 5; i++)
                {
                    PracTranss[i].GetComponent <PracTrans>().eq = new Eq("");
                    PracTranss[i].GetComponent <PracTrans>().setEq();
                }
            }
            else
            {
                pm.transGlow.SetActive(true);
            }
        }
        else
        {
            pm.ProbFailed();
        }
    }
Exemplo n.º 2
0
    public Eq dsubstitute(Eq e, Eq newE)
    {
        Eq t = new Eq(this.operat, this.operand1, this.operand2);

        if (t.operat == "d")
        {
            return(new Eq("d", operand1.substitute(e, newE)));
        }
        else
        {
            if (this.operat != "")
            {
                if (operand1 != null)
                {
                    if (!operand1.print().Equals(operand1.dsubstitute(e, newE).print()))
                    {
                        return(new Eq(this.operat, operand1.dsubstitute(e, newE), this.operand2));
                    }
                }
                if (operand2 != null)
                {
                    if (!operand2.print().Equals(operand2.dsubstitute(e, newE).print()))
                    {
                        return(new Eq(this.operat, operand1, operand2.dsubstitute(e, newE)));
                    }
                }
            }
        }
        return(t);
    }