i

Argo, the vacuum cleaner

Objective: Collect power-ups in a rectangular box with four rows

Task 1: Cleanup

(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)

Instructions to activate debug mode 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()
            

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:

Suche

v
100.114.12.1
inf-schule.de/entwuerfe/tba/unterprogramme-spacebug-en/loesungsversuch
inf-schule.de/100.114.12.1
inf-schule.de/@/page/8vqwScxlED30Z8fL

Rückmeldung geben