/!\ this is a first draft
It is utmost important to understand that mathmaker is not a software intended to compute mathematical stuff, but to display it. For instance, the aim of mathmaker is not to resolve a first-degree equation, because we don't need any computer to do it, and because other softwares can do that certainly, no, mathmaker will determine and display the steps of this resolution. Sometimes, mathmaker will also try to mimic the pupils' way of doing things.
For instance, it won't automatically simplify a fraction to make it irreducible in one step, but will try to reproduce the steps that pupils usually need to simplify the fraction. So the GCD is only used to check when the fraction is irreducible and for the cases where there's no other choice, but not as the mean to simplify a fraction directly (not before pupils learn how to use it, at least).
Another example is the need of mathmaker to control the displaying of decimal and integer numbers perfectly. Of course, most of the time, it doesn't matter when a computer tells that 5.25.2 = 27.040000000000003 or 3.93.9 = 15.209999999999999 because everyone knows that the correct results are 27.04 and 15.21 and because the difference is not so important, so in many situations, this precision will be sufficient. But, can we tell kids that the result of 5.2*5.2 is 27.040000000000003 ? And simply round the result is not always the good solution to this problem !
Also, the human rules we use to write maths are full of exceptions and strange details we don't notice usually because we're familiar to them. We would never write +2x² + 1x - 1(+5 - 1x) but instead 2x² + x - (5 - x). There are many conventions in the human way to write maths and many exceptions.
These are the reasons why the core is quite complex : re-create these writing rules and habits on a computer and let the result be readable by pupils is not always simple.
Mathmaker creates Sheets of maths Exercises. Each Exercise contains Questions. Each Question uses objects from the core, that embbed enough information to compute and write the text of the Question and also the answer.
The informations embedded by the core objects are independant from the output format. For instance, a Question about Pythagora's theorem would embed an object RightTriangle (which itself embeds information on its sides' lengths for instance ; and enough methods to create a picture of it) but also fields telling if the figure should be drawn in the Question's text or if only a description of the figure should be given ; if the hypotenuse should be calculated or another side ; if the result should be a rounded decimal and how precise it should be etc.
When a new Sheet is created, all objects it contains are created randomly (following some rules, though...).
The "Machine" object can be seen as a typewriter : it takes the mathematical objects and turns them into the output format (LaTeX, so far) ; it draws figures from the geometrical objects (using eukleides) etc. The Sheet object given to a Machine is a guideline for the Machine to type what is expected on output.
So, the main executable, mathmaker, just creates a (LaTeX) Machine and let it "type" the sheet the user has given as parameter.
All content created by mathmaker is written in stdin (except debugging informations, which are written in stderr).
Some details before diving into core :
The file mathmaker.cfg contains some variable the user might like to change easily without having to dive into the code
The lib directory contains various methods and variables
The locale directory contains all stuff related to internationalization (here are the po files to edit with poedit)
The maintenance directory contains anything related to debugging and to tests.