A more elegant approach
Apparently, it is bad to copy large amounts of code.
Task 2: A New Command
Down below, you will find a program with a new command.
(a) 🧑🧑
For clarity, the code is separated into two halves (##########
).
Briefly discuss in pairs what the significance of the two halves might be.
(b) 🧑🧑 Run the program in debug mode (see right). Observe when the switch between the two halves occurs.
(c) 🧑 Complete the program so that in the first world, all power-ups are collected. Try it alone at first.
Remember to save your results in the learning environment (Lernumgebung
)!
Task 3: Knowledge store: Subprograms
Self-defined commands like collectUntilWall
are called subprograms.
Fill in the knowledge store on subprograms on the tablet.
→ Download: Learning environment or here
Tasks for the knowledge storage:
- Complete gaps in the program.
- Enter technical terms in the boxes on the right.
- Name problems when copying code.
🧪 Code Test: Invert Line
Task 4: Improvements
Improve the solution from Task 2:
(a) Simplify the program with additional subprograms. In the lower half, 7 individual commands should suffice.
(b) Test the program in the second world and revise it accordingly. Hint: Use debug mode again.