FourierTransformer / DailyMath

the daily math webapp!
https://dailymath.io
GNU General Public License v2.0
1 stars 0 forks source link

Come up with extendible way to verify problems #5

Open FourierTransformer opened 8 years ago

FourierTransformer commented 8 years ago

At the moment I do a string compare to verify the problem. I need to come up with a way to verify solutions to more than just strings. Potentially send something back from the database. This one gets tough.

So, if 42 was the answer and numericalCompare was set, 40+2 in the submit box should be valid using the following:

{
    "solution": "42",
    "wayToSolve": "numericalCompare"
}

For something more complicated (ie calculus) doing a variable replace then a numerical compare might be the easiest way to go:

{
    "solution": "5x^2" or "2500"?,
    "wayToSolve": "valueReplaceNumericalCompare",
    "replace": [ {"x": 10}, {"c": 0}, {"k": 0}]
}
FourierTransformer commented 8 years ago

As of b26aff3625ee39fb7f5756c066a605404a48e5c5, this looks like this:

            "solution": {
                "answer": 5,
                "method": "Numerical Compare",
                "json": [json goes here]
            },

which makes a problem look a lot like:

        {
            "level": 1,
            "answer_desc": "when you have three things and add two you end up with five things.",
            "hint": "basic addition",
            "solution": {
                "answer": 5,
                "method": "Numerical Compare"
            },
            "category": "Pre-Algebra",
            "problem": "Evaluate 3+2",
            "name": "test problem",
            "date": "October 15th, 2015"
        }

and i think I'll go with the bottom one for Value Replace!

FourierTransformer commented 8 years ago

other than showing the answer is a lot harder with that... so, i think the value replace will substitue in the supplied "solution" as well as the user's input and then do a verify. Here's hoping for the best!

FourierTransformer commented 8 years ago

for problems that accept units, I want to be able to handle natural language inputs. This is already done for duration which will async load a script and then use the compare lookup to determine how to validate the answer - which seems to work well.

FourierTransformer commented 8 years ago

For "pure math" answers. I think I'll end up using the math.js api to verify problems. I will have to work around their time limit however.

FourierTransformer commented 8 years ago

I'm planning on working around it by just sending it to the user's browser.