5. Advanced functionality supported in logic.py¶
This section describes advanced functionality available through the logic.py file for each game that you may need as your game becomes more sophisticated.
Before reading this section, you should be familiar with the basic functionality supported in the logic.py file for each game. If you have followed this documentation in order, you will have read about this basic functionality. As a reminder, the relevant sections of the documentation were:
section “Modify SublevelBehaviour”,
section “Modify SublevelBehaviour docstrings”,
section “Modify GameStateCustom”,
section “Modify create_game_round()”,
section “Modify the game logic” relating to modifying the function
_decide_on_problem_instance(),section “Update the function _decide_on_answers”, and
section “Modify GAME_BEHAVIOUR” about the file
behaviour.py.
5.1. Creating your own enumerated type¶
Let’s say you wanted to vary the difficulty of your colour-based game to use only the two colours black and white on easy levels, progressing to the three primary colours on slightly harder levels, and then including all colours in the rainbow on the hardest levels. You could use an integer parameter to SublevelBehaviour where 0 meant black and white, 1 meant primary colours, and so on.
<< TODO: enumerated_type example, e.g. GameMode from kangaroo and password. Others: ordered, slice, slicing, tunnel, funnywindows >>