-
Notifications
You must be signed in to change notification settings - Fork 0
How to add an exercise
An exercise is part of a lesson. In this case, we're assuming the lesson already exists and we only want to add an exercise (a tab) to it.
If you want to create a whole new lesson, see How to create a lesson
-
Find the package you want to add to. It will be something like lesson.nameOfTheLesson. For the sake of explaining, let's take lesson.maze.
-
Check out the Main class from the package you chose.
- You'll find it extends the abstract class Lesson. (more on that in How to create a lesson)
- Notice how to add an exercise :
protected void loadExercises() {
addExercise(new MyFirstExercise(this));
addExercise(new MySecondExercise(this));
addExercise(new MyThirdExercise(this));
}
-
Now you need to create your Exercise class. It needs to extend ExerciseTemplated
- The constructor takes a Lesson as a parameter, just start with
super(lesson)
. - Create a world (any class extending World)
- Call
setup(myWorld)
- The constructor takes a Lesson as a parameter, just start with
-
Create a class extending the entity of the world you've chosen.
The Entity class contains arun()
method which contains the solution code and the student-written code.
/* BEGIN TEMPLATE */
// Any hint for the users
MethodToWrite() {
/* BEGIN SOLUTION */
Le code de la solution
/* END SOLUTION */
/* END TEMPLATE *
-
Add the new exercise in the Main class the same way as in 2.
addExercice(new MyExercice(this))
-
Add a HTML description file MyExercice.html