Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Amerlander committed Aug 22, 2024
1 parent bb911f8 commit 29babe3
Show file tree
Hide file tree
Showing 9 changed files with 604 additions and 1,196 deletions.
21 changes: 11 additions & 10 deletions docs/calliope/arbeitsheft/42-2_orakel.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# 42 2 Oracle

```ghost
let Zufall = 0
let zufall = 0
input.onGesture(Gesture.Shake, function () {
Zufall = randint(0, 2)
if (Zufall == 1) {
basic.showString("Ja")
}
if (Zufall == 2) {
basic.showString("Nein")
}
if (Zufall == 3) {
basic.showString("Vielleicht")
zufall = randint(0, 2)
if (zufall == 1) {
basic.showString("Ja")
}
if (zufall == 2) {
basic.showString("Nein")
}
if (zufall == 3) {
basic.showString("Vielleicht")
}
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/calliope/arbeitsheft/49-1_schaetzspiel.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 49 1 Estimation game

```ghost
let Entfernung = 0
let distance = 0
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
Entfernung = Math.round(grove.measureInCentimeters(DigitalPin.C16))
distance = Math.round(grove.measureInCentimeters(DigitalPin.C16))
})
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
basic.showNumber(Entfernung)
basic.showNumber(distance)
})
basic.forever(function () {
basic.showLeds(`
Expand All @@ -32,7 +32,7 @@ Press button A to measure the distance and save it in a variable. Press button B
Insert the block ``||input.on button A is clicked||`` twice and change the button to ``B`` for one block. Tip: You can duplicate the block by right-clicking.

## Define variable
To save the distance when the button is pressed and retrieve it later, create a ``||variable.variable||`` and name it *Distance*.
To save the distance when the button is pressed and retrieve it later, create a ``||variable.variable||`` and name it *distance*.


```
Expand Down
129 changes: 65 additions & 64 deletions libs/core/blocks-test/control.blocks
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
<xml xmlns="http://www.w3.org/1999/xhtml">
<variables>
<variable type="" id="tgDN]qF_Ah1Z*?=|+?^Y">item</variable>
</variables>
<block type="control_in_background" x="-13" y="175">
<statement name="HANDLER">
<block type="control_reset">
<next>
<block type="control_wait_us">
<value name="micros">
<shadow type="math_number" id="w]G5E,EGl+SOB?91N4SV">
<field name="NUM">4</field>
</shadow>
<block type="control_event_timestamp&quot;"></block>
</value>
<next>
<block type="control_raise_event">
<value name="src">
<shadow type="control_event_source_id" id="~$#[A%Y{}%ZvxA7_z/6+">
<field name="id">EventBusSource.MICROBIT_ID_BUTTON_A</field>
</shadow>
<block type="control_event_value&quot;"></block>
</value>
<value name="value">
<shadow type="control_event_value_id" id="=OWyqW(E=RBE^i;;QC0$">
<field name="id">EventBusValue.MICROBIT_EVT_ANY</field>
</shadow>
<block type="control_device_serial_number"></block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="control_on_event" x="-58" y="393">
<value name="src">
<shadow type="control_event_source_id" id="o,i-zrB1+%JG/,EC.6zB">
<field name="id">EventBusSource.MICROBIT_ID_BUTTON_A</field>
</shadow>
<block type="control_event_value_id">
<field name="id">EventBusValue.MES_DPAD_BUTTON_C_UP</field>
</block>
</value>
<value name="value">
<shadow type="control_event_value_id" id="n2s(-M;{|izma6OZGq:F">
<field name="id">EventBusValue.MICROBIT_EVT_ANY</field>
</shadow>
<block type="control_event_value_id">
<field name="id">EventBusValue.MES_REMOTE_CONTROL_EVT_PLAY</field>
</block>
</value>
<statement name="HANDLER">
<block type="variables_set">
<field name="VAR" id="tgDN]qF_Ah1Z*?=|+?^Y" variabletype="">item</field>
<value name="VALUE">
<shadow type="math_number" id="$3|;#yTHhAwO-r1Bsk:B">
<field name="NUM">0</field>
</shadow>
<block type="control_device_name"></block>

<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="tgDN]qF_Ah1Z*?=|+?^Y">item</variable>
</variables>
<block type="control_in_background" x="0" y="0">
<statement name="HANDLER">
<block type="control_reset">
<next>
<block type="control_wait_us">
<value name="micros">
<shadow type="math_number">
<field name="NUM">4</field>
</shadow>
<block type="control_event_timestamp&quot;"/>
</value>
<next>
<block type="control_raise_event">
<value name="src">
<shadow type="control_event_source_id">
<field name="id">EventBusSource.MICROBIT_ID_BUTTON_A</field>
</shadow>
<block type="control_event_value&quot;"/>
</value>
<value name="value">
<shadow type="control_event_value_id">
<field name="id">EventBusValue.MICROBIT_EVT_ANY</field>
</shadow>
<block type="control_device_serial_number"/>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="control_on_event" x="-1" y="350">
<value name="src">
<shadow type="control_event_source_id">
<field name="id">EventBusSource.MICROBIT_ID_BUTTON_A</field>
</shadow>
<block type="control_event_value_id">
<field name="id">EventBusValue.MES_DPAD_BUTTON_C_UP</field>
</block>
</value>
</block>
</statement>
</block>
<value name="value">
<shadow type="control_event_value_id">
<field name="id">EventBusValue.MICROBIT_EVT_ANY</field>
</shadow>
<block type="control_event_value_id">
<field name="id">EventBusValue.MES_REMOTE_CONTROL_EVT_PLAY</field>
</block>
</value>
<statement name="HANDLER">
<block type="variables_set">
<field name="VAR" id="tgDN]qF_Ah1Z*?=|+?^Y">item</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
<block type="control_device_name"/>
</value>
</block>
</statement>
</block>
</xml>
Loading

0 comments on commit 29babe3

Please sign in to comment.