SectionΒ 3. ChapterΒ 5
ninja.py
Decomposition
Swipe to show menu
Decomposition means breaking a large solution into smaller functions and combining them freely. You can call one custom function inside another, mix your own functions with the Ninja's built-in methods, and reuse them as many times as needed.
By layering simple actions step by step, you can build complex behavior while keeping your code clear and easy to manage. Study the code below:
ninja.py
As you can see, move_to_next_tunnel uses built-in methods, loot_tunnel uses move_to_next_tunnel and built-in methods, and ninja_controller uses loot_tunnel 3 times.
Check move_to_next_row(ninja)

Check collect_row(ninja)

Task
Swipe to start coding
Solution
Explore other courses in Catalog
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 5
ninja.py
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat