Hello @Vitaliy Kaurov ,
I haven't taken Random Functions into account yet.
JSON Template looks something like this:
[
{
"Number": "11.2",
"Question": "Make a single string of the whole alphabet, in upper case.",
"Answer": "`Function`[StringJoin[Alphabet[\"`Alphabet`\"]]]",
"Template": "Make a single string of the all `Alphabet` alphabets, using `Function`.",
"Data": {"Function": ["ToUpperCase", "ToLowerCase"], "Alphabet": ["French","Russian", "Italian", "English","German"]}
},
{
"Number":"1.3",
"Question":"Multiply the whole numbers from 1 to 5.",
"Answer":"Times @@ Range[1, `Number`]",
"Template":"Multiply the whole numbers from 1 to `Number`.",
"Data":{"Number": "RandomInteger[{5,10}]"}
},
{
"Number":"4.1",
"Question":"Make a bar chart of `Number`.",
"Answer":"`Function`[`Number`]",
"Template":"Make a `Function` of `Number`.",
"Data":{"Function":["BarChart3D","BarChart","PieChart","PieChart3D","ListLinePlot"],"Number":"RandomInteger[50, 4]"}
}
]
To check for correctness, I execute the originally solution expression and execute the user provided answer expression.
If these two match, then its correct.
Since Wolfram Language is a symbolic language, it just compares at the lowest level of both executed expressions.
However, the problem with this approach is, This prototype doesn't work with Random Function. Since Random function will store the final answer in different values at the lowest level.