Adding a new Level - hpi-swa-teaching/InteractivePongTutorial GitHub Wiki
Every level is a subclass of IPTLevel, which in turn is a TestCase subclass.
Naming Convention
Level classes have the naming convention IPTLevel[Chapter number][Level number]. So the class of the third level in chapter two is named IPTLevel0203.
Static info
Each level implements the following class methods:
asString: String that contains the name of the levellevelIndex: The position of the level within its chaptervisibleCodePieces: A dictionary that contains the methods that are visible in this level. They are saved as a Tupel of the Class and method e.g. { {IPTGame. #initialize}. {IPTBall. #initialize} }description: a string that is displayed in the ChapterViewexplanations: a collection of strings, that are displayed in the explanationBox in the IPTBrowser
Testing the user code
Furthermore, your level class contains instance methods, that test the user-written code. Add those methods to the category levelTests. The tests are then automatically executed when the user runs their code.
Defining the game methods for your level
Each game method needs to be initialized beforehand via an asset. Change the assets as needed. Refer to the Asset Structure.
When adding a new method into the assets, do not forget to list the file in methodIndex.txt too!