How to support a new exercise type

Check list

Let's assume that a new exercise type, named 'New Exercise', is going to be programmed. These are the steps to follow:

  1. In /src/exercises/ create the exercises control NewExerciseCtrol

  2. In /src/html/ create the exercises params object NewExerciseCtrolParms.h

  3. Include the new control in /scr/html/Tags.cpp
    1. Add #include "../exercises/NewExerciseCtrol.h"
    2. Add #include "NewExerciseCtrolParms.h"
    3. Modify enum EHtmlObjectTypes (located just before TAG_HANDLER_PROC(tag) ) to add a new item eHO_Exercise_NewExercise
    4. Modify TAG_HANDLER_PROC(tag) to take into account the new exercise (in two points)
    5. Review documentation comments

Optionally, you might have to use helper classes, such as constrains to configure the exercises or generators to generate the exercise values. Typically, you should:

  1. In /src/exercises/ create the exercise constrains object NewExerciseConstrains.cpp,.h

  2. Modify /src/exercises/Generators.cpp,.h to add new random/constrained generator methods

Finally, to test the new control you have to:

  1. Add a test page to a book (i.e. v3_TestBook):
    1. Create file for new page (i.e. v3_TestBook_NewExercise.htm)
    2. Add this page to TOC file v3_testBook.hhc
    3. Add this page to index file v3_testBook.hhk
    4. Do not forget to empty directory /temp to force the program to load a fresh updated version of the test book.