Pflanzenbewässerung Lösung: Unterschied zwischen den Versionen

Aus microbit - Das Schulbuch
Wechseln zu: Navigation, Suche
Zeile 12: Zeile 12:
 
</pre>
 
</pre>
  
 
+
<pre id="01">
 +
let anzahl_kopf = 0
 +
let anzahl_zahl = 0
 +
input.onGesture(Gesture.Shake, function () {
 +
    if (Math.randomBoolean()) {
 +
        anzahl_kopf += 1
 +
        basic.showLeds(`
 +
            . # . . #
 +
            . # . # .
 +
            . # # . .
 +
            . # . # .
 +
            . # . . #
 +
            `)
 +
    } else {
 +
        anzahl_zahl += 1
 +
        basic.showLeds(`
 +
            . # # # #
 +
            . . . . #
 +
            . . # # .
 +
            . # . . .
 +
            . # # # #
 +
            `)
 +
    }
 +
})
 +
</pre>
  
 
== Komplettlösungen ==
 
== Komplettlösungen ==
 
xxx
 
xxx

Version vom 13. Dezember 2021, 19:16 Uhr

Grundsätzliche Überlegungen

xxx

Hilfestellungen und Lösung zum Pflanzenwächter

xxx

input.onGesture(Gesture.Shake, function () {
    if (Math.randomBoolean()) {
    	
    }
})
let anzahl_kopf = 0
let anzahl_zahl = 0
input.onGesture(Gesture.Shake, function () {
    if (Math.randomBoolean()) {
        anzahl_kopf += 1
        basic.showLeds(`
            . # . . #
            . # . # .
            . # # . .
            . # . # .
            . # . . #
            `)
    } else {
        anzahl_zahl += 1
        basic.showLeds(`
            . # # # #
            . . . . #
            . . # # .
            . # . . .
            . # # # #
            `)
    }
})

Komplettlösungen

xxx