How Njoror's Problem Templates are Written
Njoror is a platform that helps you learn mathematics. Inevitably this involves solving problems which for me involves writing problems. A lot of problems.
To assist writing these lot of problems, I have created a problem author tool that eases creating the problem templates. The templates themselves are just JSON files, but those are annoying to create by hand hence we need some user interface.
Note: The UI is backend UI, not meant for general users.
First we need to define the general problem parameters such as the name and the properties as well as the relationships to other problems and concepts.
After having the basic general information down, we can write the problem prompt itself. Here we can also define any bound values.
Bound values are either random variables getting their values from a probability distribution (usually discrete uniform distributions), or some function of the random variables. While simple, this is incredibly powerful, and we can construct all sorts of very complicated problem templates using this setup.
Then we define the input. Inputs are a type of widget - custom html rendered in the problem prompt - which also send data to the server for evaluation once the problem has been answered. There can be many inputs in a single problem, but for this problem we only need one.
The expression input is a simple yet very flexible input widget, and neatly suits our purposes here.
First we need to define what kinds of operations the student is allowed to use in order to hand in the answer. For simple addition problems for example, the student shouldn't be able to write "5+5=5+5", but for more complicated problems such as this one, we can allow the student to write the answer in any way they want.
The second part consists of writing answer patterns that match different user inputs. We start by writing the correct pattern, and marking it as correct.
We can then test the problem to check that we have defined it correctly.
The final step in defining the problem is adding custom feedback for common errors. For example, we can add some more incorrect answer patterns.
And that's it. That's the basics of how to problem author works. There are many more widgets that we didn't get into, and I keep adding more widgets as I want to create types of problems that are not supported yet.
But as I have hopefully demonstrated, the problem author module is a simple yet powerful way to define problems.
If you want to be one of the first people to try Njoror, you can sign up for early access.