Argo, the vacuum cleaner
![](https://schuljahr.inf-schule.de/aktuell/content/100_entwuerfe/114_tba/12_unterprogramme-spacebug-en/1_loesungsversuch/problemstellung.png)
Task 1: Cleanup
![](https://schuljahr.inf-schule.de/aktuell/content/100_entwuerfe/114_tba/12_unterprogramme-spacebug-en/1_loesungsversuch/weltenwechsler_en.png)
(a) Complete the solution below so that all power-ups are collected in World 1.
(b)
Click on World 2 (see right) and start the program.
An error message appears:
Collision with an asteroid! Check line 7. (Kollision mit einem Asteroiden! Prüfe Zeile 7.
)
Find the error in the program and correct it.
💡 Tip for part (b)
Activate debug mode.
Examine which lines are executed when the Argo is on the last power-up of the first level.
💡 No idea yet?
3 if onPow():
4 removePow()
5 move()
6 if not onPow():
7 move()
![](https://schuljahr.inf-schule.de/aktuell/content/100_entwuerfe/114_tba/12_unterprogramme-spacebug-en/1_loesungsversuch/fehler_vorher.png)
![](https://schuljahr.inf-schule.de/aktuell/content/100_entwuerfe/114_tba/12_unterprogramme-spacebug-en/1_loesungsversuch/fehler_schritt_1.png)
![](https://schuljahr.inf-schule.de/aktuell/content/100_entwuerfe/114_tba/12_unterprogramme-spacebug-en/1_loesungsversuch/fehler_schritt_2.png)
Argo runs into a wall in line 7 because it moves twice: Both if statements are executed (line 3 and line 6).
Use an if-else-construct to change this.
💡 Still no idea?
Change the code as shown in the flowchart: