Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.

Commit 4f36096

Browse files
committed
Web 0.14.28: VisuBot-Befehle farblich nach Gruppen
Streifen in der Palette, Punkte an Gruppen und im Nachschlagen; Gruppe Licht/Ton/Bildschirm geteilt. Kästen bleiben gelb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ugz28VNUeu1hn8zWaCPkwJ
1 parent 6b56b51 commit 4f36096

22 files changed

Lines changed: 1580 additions & 1472 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.
88

99
### Changed
1010

11+
- **Web 0.14.28, VisuBot commands grouped by colour:** in the palette every mBot2 box gets a 4 px stripe on the left and every group heading a dot in the colour of its group: driving and wheels orange, light (LEDs) yellow-green, sound magenta, screen and emotions indigo, waiting and stopwatch grey, all sensors turquoise. The boxes themselves stay yellow (statement), and the structure chart and the code are unchanged. The former group „Licht, Ton und Bildschirm“ is split into „Licht“, „Ton“ and „Bildschirm“ in the palette and in the VisuBot Nachschlagen (de/en), whose `###` headings show the same dots. New lesson syntax `### Überschrift {.klasse}`. With „Blöcke farbig“ off, stripes and dots disappear.
1112
- **Web 0.14.27, VisuBot: `forward`/`backward` overloaded with a unit:** besides `mbot.forward()` (10 cm) and `mbot.forward(30)` there is now `mbot.forward(2, "Umdrehungen")` and `mbot.forward(30, "cm")` (en `"rotations"`, pt `"rotações"`), same for `backward`. One wheel rotation is π · 6.5 cm ≈ 20.4 cm; the action stores the distance in cm, so simulation, exercise check and the real robot (`mbot2.straight`) work unchanged, and the console shows e.g. „2 Umdrehungen vorwärts (40.84 cm)“. An unknown unit is an error naming the allowed units. The CyberPi program export gets the same overload. VisuBot lesson 22 gets a step „Gleicher Name, andere Parameter: Überladung“ with the three headers, a Ludwig Angeberwissen asking pupils to measure their own robot with a printable test record (PDF, de/en, `website/visubot/messprotokoll-radumdrehung.pdf` / `test-record-wheel-rotation.pdf`: wheel diameter, five test cases expected vs. actual, evaluation, causes, feedback for the teacher, box „So testet man Softwaresysteme“), the exercise „Quadrat mit Umdrehungen“ and a quiz; Nachschlagen, glossary („Überladung“) and code completion list the new variants (de/en).
1213
- **Web 0.14.26, animation: nested loop fills a times table in lesson 14:** in step „Schleife in der Schleife“, after the triangle example (which keeps the names `zeile`/`stern`), a new sentence says experienced programmers call the counters `i` and `j`, followed by an animated structure chart: the active block lights up, a variables box shows `i`, `j` and `text` (pt `texto`), and the console fills line by line with `1 2 3 4`, `2 4 6 8`, `3 6 9 12`. It shows that `j` starts again at 1 on every new line. Plays once when visible, „Noch einmal abspielen“ replays it (de/en/pt).
1314
- **Web 0.14.25, „Bombe entschärfen“: tap part of a line:** a bomb round can name the wrong part with `stelle:` (e.g. `stelle: i++`). Such rounds show the parts of every line as tappable boxes (the three fields of a `for` header, the condition of `if`/`while`, target and value of an assignment, call and arguments split at `+`); right line but wrong part gives its own hint. Lesson 13 (6 of 8 rounds) and lesson 15 (all 6 rounds) use it (de/en/pt, texts in all 21 languages).

‎web/lessons/de/visubot/nachschlagen.md‎

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Ein Befehl sagt dem mBot2, was er **tun** soll. Jeder Befehl beginnt mit `mbot.` und endet mit Klammern. In die Klammern schreibst du oft eine Zahl.
44

5-
### Fahren und Drehen
5+
### Fahren und Drehen {.bot-fahren}
66

77
Der mBot2 fährt geradeaus oder dreht sich auf der Stelle.
88

@@ -24,7 +24,7 @@ mbot.turnRight(180) dreht sich ganz um
2424
2525
> Für ein Vieleck dreht er sich insgesamt einmal ganz herum: Dreieck 3 × 120°, Quadrat 4 × 90°, Sechseck 6 × 60°.
2626
27-
### Räder einzeln
27+
### Räder einzeln {.bot-fahren}
2828

2929
Hier gibst du jedem Rad selbst Gas. Die Zahlen sind Prozent: 100 ist volles Gas, 0 ist Stillstand, eine Zahl mit Minus fährt rückwärts. Der mBot2 fährt so lange weiter, bis ein anderer Fahrbefehl kommt.
3030

@@ -35,24 +35,36 @@ mbot.drive(40, -40) ein Rad vor, eins zurück: dreht sich
3535
mbot.stop() hält an
3636
```
3737

38-
### Licht, Ton und Bildschirm
38+
### Licht {.bot-licht}
3939

40-
Der mBot2 kann leuchten, piepen und Text zeigen.
40+
Der mBot2 hat fünf LEDs mit den Nummern 0 bis 4.
4141

4242
```
4343
mbot.setLed(255, 0, 0) alle LEDs leuchten rot
4444
mbot.ledOff() alle LEDs aus
4545
mbot.led(0).setColor("grün") nur LED 0 leuchtet grün
4646
mbot.led(0).setColor("aus") nur LED 0 aus
47+
```
48+
49+
Bei `setLed` mischst du Rot, Grün und Blau, jedes von 0 (aus) bis 255 (ganz hell).
50+
51+
### Ton {.bot-ton}
52+
53+
```
4754
mbot.playTone(440, 300) spielt einen Ton
55+
```
56+
57+
Die erste Zahl ist die Tonhöhe. Je größer, desto höher. Die zweite Zahl ist die Länge in Millisekunden (1000 Millisekunden sind 1 Sekunde).
58+
59+
### Bildschirm {.bot-anzeige}
60+
61+
```
4862
mbot.showText("Hallo") zeigt Hallo auf dem Bildschirm
4963
```
5064

51-
- **LEDs:** Es gibt fünf LEDs mit den Nummern 0 bis 4. Bei `setLed` mischst du Rot, Grün und Blau, jedes von 0 (aus) bis 255 (ganz hell).
52-
- **Ton:** Die erste Zahl ist die Tonhöhe. Je größer, desto höher. Die zweite Zahl ist die Länge in Millisekunden (1000 Millisekunden sind 1 Sekunde).
53-
- **Bildschirm:** Mit `+` hängst du Text und Zahlen aneinander: `mbot.showText("Abstand: " + mbot.getDistance())`.
65+
Mit `+` hängst du Text und Zahlen aneinander: `mbot.showText("Abstand: " + mbot.getDistance())`.
5466

55-
### Gefühle
67+
### Gefühle {.bot-anzeige}
5668

5769
Der mBot2 zeigt ein Gefühl mit Licht, Ton und Wackeln. Das siehst du nur am echten mBot2.
5870

@@ -64,7 +76,7 @@ mbot.emotion("wow") staunt
6476

6577
Weitere Gefühle: hello, yeah, proud, yummy, naughty, uh_oh, hurt, angry, startle, shiver, dizzy, sleepy, zzz, wake_up, blink, yes, no, look_up, look_down, look_left, look_right, look_around
6678

67-
### Warten und Stoppuhr
79+
### Warten und Stoppuhr {.bot-warten}
6880

6981
```
7082
mbot.pause(1000) wartet 1 Sekunde
@@ -77,7 +89,7 @@ Die Zeit der Stoppuhr liest du mit dem Sensor `mbot.getTimer()` (unten bei **Sto
7789

7890
Ein Sensor **misst** etwas und gibt dir einen Wert zurück. Den Wert benutzt du in einer Bedingung, zum Beispiel in einer Schleife oder Verzweigung. Manche Sensoren liefern eine **Zahl**, manche **wahr oder falsch**, einer einen **Text**.
7991

80-
### Abstand
92+
### Abstand {.bot-sensor}
8193

8294
Der Ultraschallsensor vorn misst, wie weit die nächste Wand weg ist, in Zentimetern.
8395

@@ -87,7 +99,7 @@ mbot.getDistance() > 15 ist vorn mehr als 15 cm frei?
8799
int abstand = mbot.getDistance() Abstand in einer Variablen merken
88100
```
89101

90-
### Linie
102+
### Linie {.bot-sensor}
91103

92104
Unter dem mBot2 sitzen vier Fühler. Sie sehen, ob der Boden schwarz ist.
93105

@@ -99,7 +111,7 @@ mbot.isLineLeft() sieht der linke mittlere Fühler Schwarz?
99111
mbot.isLineRight() sieht der rechte mittlere Fühler Schwarz?
100112
```
101113

102-
### Farben
114+
### Farben {.bot-sensor}
103115

104116
Derselbe Sensor unten erkennt auch Farben. `mbot.getColor()` gibt dir den Namen der Farbe als Text: `"rot"`, `"grün"`, `"blau"`, `"gelb"`, `"weiß"` oder `"schwarz"`.
105117

@@ -110,7 +122,7 @@ mbot.getColor().equals("rot") steht er auf Rot?
110122

111123
> Texte vergleichst du mit `.equals(…)`, nicht mit `==`. Das `!` davor heißt **nicht**.
112124
113-
### Tasten und Joystick
125+
### Tasten und Joystick {.bot-sensor}
114126

115127
Auf dem CyberPi gibt es die Tasten A und B und einen kleinen Joystick. Jeder Sensor sagt **wahr**, solange gedrückt wird.
116128

@@ -123,14 +135,14 @@ mbot.isJoystickLeft() Joystick nach links gedrückt?
123135
mbot.isJoystickRight() Joystick nach rechts gedrückt?
124136
```
125137

126-
### Licht und Lautstärke
138+
### Licht und Lautstärke {.bot-sensor}
127139

128140
```
129141
mbot.getBrightness() wie hell? 0 ist dunkel, 100 ist hell
130142
mbot.getLoudness() wie laut? 0 ist still, 100 ist laut
131143
```
132144

133-
### Neigung und Schütteln
145+
### Neigung und Schütteln {.bot-sensor}
134146

135147
```
136148
mbot.getPitch() nach vorn oder hinten gekippt? (in Grad)
@@ -140,7 +152,7 @@ mbot.isShaken() wird er geschüttelt?
140152

141153
> Liegt der mBot2 flach, sind beide Neigungen 0. In der Simulation stellst du diese Werte unter **🎛 Sensoren ausprobieren** ein.
142154
143-
### Stoppuhr und Akku
155+
### Stoppuhr und Akku {.bot-sensor}
144156

145157
```
146158
mbot.getTimer() Sekunden seit dem Start oder seit resetTimer()

‎web/lessons/en/visubot/nachschlagen.md‎

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A command tells the mBot2 what to **do**. Every command starts with `mbot.` and ends with brackets. Often you write a number in the brackets.
44

5-
### Driving and turning
5+
### Driving and turning {.bot-fahren}
66

77
The mBot2 drives straight or turns on the spot.
88

@@ -24,7 +24,7 @@ mbot.turnRight(180) turns all the way round
2424
2525
> For a polygon it turns all the way round once in total: triangle 3 × 120°, square 4 × 90°, hexagon 6 × 60°.
2626
27-
### Wheels separately
27+
### Wheels separately {.bot-fahren}
2828

2929
Here you give each wheel gas yourself. The numbers are percent: 100 is full gas, 0 is standing still, a number with a minus drives backwards. The mBot2 keeps going until another driving command comes.
3030

@@ -35,24 +35,36 @@ mbot.drive(40, -40) one wheel forward, one back: it turns
3535
mbot.stop() stops
3636
```
3737

38-
### Light, sound and screen
38+
### Light {.bot-licht}
3939

40-
The mBot2 can light up, beep and show text.
40+
The mBot2 has five LEDs with the numbers 0 to 4.
4141

4242
```
4343
mbot.setLed(255, 0, 0) all LEDs light up red
4444
mbot.ledOff() all LEDs off
4545
mbot.led(0).setColor("green") only LED 0 lights up green
4646
mbot.led(0).setColor("off") only LED 0 off
47+
```
48+
49+
With `setLed` you mix red, green and blue, each from 0 (off) to 255 (very bright).
50+
51+
### Sound {.bot-ton}
52+
53+
```
4754
mbot.playTone(440, 300) plays a tone
55+
```
56+
57+
The first number is the pitch. The bigger, the higher. The second number is the length in milliseconds (1000 milliseconds are 1 second).
58+
59+
### Screen {.bot-anzeige}
60+
61+
```
4862
mbot.showText("Hello") shows Hello on the screen
4963
```
5064

51-
- **LEDs:** There are five LEDs with the numbers 0 to 4. With `setLed` you mix red, green and blue, each from 0 (off) to 255 (very bright).
52-
- **Tone:** The first number is the pitch. The bigger, the higher. The second number is the length in milliseconds (1000 milliseconds are 1 second).
53-
- **Screen:** With `+` you join text and numbers: `mbot.showText("Distance: " + mbot.getDistance())`.
65+
With `+` you join text and numbers: `mbot.showText("Distance: " + mbot.getDistance())`.
5466

55-
### Emotions
67+
### Emotions {.bot-anzeige}
5668

5769
The mBot2 shows a feeling with light, sound and wiggling. You only see it on the real mBot2.
5870

@@ -64,7 +76,7 @@ mbot.emotion("wow") is amazed
6476

6577
More feelings: hello, yeah, proud, yummy, naughty, uh_oh, hurt, angry, startle, shiver, dizzy, sleepy, zzz, wake_up, blink, yes, no, look_up, look_down, look_left, look_right, look_around
6678

67-
### Waiting and stopwatch
79+
### Waiting and stopwatch {.bot-warten}
6880

6981
```
7082
mbot.pause(1000) waits 1 second
@@ -77,7 +89,7 @@ You read the stopwatch time with the sensor `mbot.getTimer()` (below under **Sto
7789

7890
A sensor **measures** something and gives you a value back. You use the value in a condition, for example in a loop or a branch. Some sensors give a **number**, some **true or false**, one gives a **text**.
7991

80-
### Distance
92+
### Distance {.bot-sensor}
8193

8294
The ultrasonic sensor at the front measures how far away the next wall is, in centimetres.
8395

@@ -87,7 +99,7 @@ mbot.getDistance() > 15 is there more than 15 cm free ahead?
8799
int distance = mbot.getDistance() remember the distance in a variable
88100
```
89101

90-
### Line
102+
### Line {.bot-sensor}
91103

92104
Under the mBot2 there are four probes. They see whether the floor is black.
93105

@@ -99,7 +111,7 @@ mbot.isLineLeft() does the left middle probe see black?
99111
mbot.isLineRight() does the right middle probe see black?
100112
```
101113

102-
### Colours
114+
### Colours {.bot-sensor}
103115

104116
The same sensor underneath also recognises colours. `mbot.getColor()` gives you the name of the colour as text: `"red"`, `"green"`, `"blue"`, `"yellow"`, `"white"` or `"black"`.
105117

@@ -110,7 +122,7 @@ mbot.getColor().equals("red") is it standing on red?
110122

111123
> You compare texts with `.equals(…)`, not with `==`. The `!` in front means **not**.
112124
113-
### Buttons and joystick
125+
### Buttons and joystick {.bot-sensor}
114126

115127
On the CyberPi there are the buttons A and B and a small joystick. Each sensor says **true** while it is being pressed.
116128

@@ -123,14 +135,14 @@ mbot.isJoystickLeft() joystick pushed left?
123135
mbot.isJoystickRight() joystick pushed right?
124136
```
125137

126-
### Light and loudness
138+
### Light and loudness {.bot-sensor}
127139

128140
```
129141
mbot.getBrightness() how bright? 0 is dark, 100 is bright
130142
mbot.getLoudness() how loud? 0 is silent, 100 is loud
131143
```
132144

133-
### Tilt and shaking
145+
### Tilt and shaking {.bot-sensor}
134146

135147
```
136148
mbot.getPitch() tipped forward or back? (in degrees)
@@ -140,7 +152,7 @@ mbot.isShaken() is it being shaken?
140152

141153
> When the mBot2 lies flat, both tilts are 0. In the simulation you set these values under **🎛 Try the sensors**.
142154
143-
### Stopwatch and battery
155+
### Stopwatch and battery {.bot-sensor}
144156

145157
```
146158
mbot.getTimer() seconds since the start or since resetTimer()

‎web/package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎web/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visustruct-web",
33
"private": true,
4-
"version": "0.14.27",
4+
"version": "0.14.28",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

‎web/src/i18n/de.strings‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@
422422
"web_visubot_preview_limit" = "läuft sehr lange (Endlosschleife?), gezeigt ist der Anfang";
423423
"web_visubot_group_drive" = "Fahren und Drehen";
424424
"web_visubot_group_wheels" = "Räder einzeln";
425-
"web_visubot_group_output" = "Licht, Ton und Bildschirm";
425+
"web_visubot_group_leds" = "Licht";
426+
"web_visubot_group_sound" = "Ton";
427+
"web_visubot_group_screen" = "Bildschirm";
426428
"web_visubot_group_emotion" = "Gefühle";
427429
"web_visubot_group_wait" = "Warten und Stoppuhr";
428430
"web_visubot_group_distance" = "Abstand";

‎web/src/i18n/en.strings‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@
422422
"web_visubot_preview_limit" = "runs for a very long time (endless loop?), showing the start";
423423
"web_visubot_group_drive" = "Driving and turning";
424424
"web_visubot_group_wheels" = "Wheels separately";
425-
"web_visubot_group_output" = "Light, sound and screen";
425+
"web_visubot_group_leds" = "Light";
426+
"web_visubot_group_sound" = "Sound";
427+
"web_visubot_group_screen" = "Screen";
426428
"web_visubot_group_emotion" = "Emotions";
427429
"web_visubot_group_wait" = "Waiting and stopwatch";
428430
"web_visubot_group_distance" = "Distance";

‎web/src/i18n/pt-PT.strings‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@
420420
"web_visubot_preview_limit" = "demora muito (ciclo infinito?), mostra-se o início";
421421
"web_visubot_group_drive" = "Andar e rodar";
422422
"web_visubot_group_wheels" = "Rodas separadas";
423-
"web_visubot_group_output" = "Luz, som e ecrã";
423+
"web_visubot_group_leds" = "Luz";
424+
"web_visubot_group_sound" = "Som";
425+
"web_visubot_group_screen" = "Ecrã";
424426
"web_visubot_group_emotion" = "Emoções";
425427
"web_visubot_group_wait" = "Esperar e cronómetro";
426428
"web_visubot_group_distance" = "Distância";

‎web/src/learn/markdown.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export function markdownToHTML(source: string): string {
4848
const heading = /^(#{2,4})\s+(.*)$/.exec(line)
4949
if (heading) {
5050
const level = heading[1].length
51-
out.push(`<h${level}>${inline(heading[2])}</h${level}>`)
51+
// `### Licht {.bot-licht}`: Klasse an der Überschrift (Farbpunkt der VisuBot-Gruppe im Nachschlagen)
52+
const cls = /\s*\{\.([a-z][a-z-]*)\}$/.exec(heading[2])
53+
const text = cls ? heading[2].slice(0, cls.index) : heading[2]
54+
out.push(`<h${level}${cls ? ` class="${cls[1]}"` : ''}>${inline(text)}</h${level}>`)
5255
i++
5356
continue
5457
}

‎web/src/ui/app.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { progress } from '../learn/progress'
4444
import { codeKeywords, currentLanguage, offeredLanguages, setCodeKeywords, setLanguage, t, type LanguageCode } from './i18n'
4545
import * as Export from './exporter'
4646
import { SimulationPanel } from './simulationPanel'
47-
import { mbotLinkText, setVisuBotMode, setVisuFlowWorld, setVisuObjectWorld, visuBotBrand, toggleMBotLink, visuBotEnabled, visuBotMode, visuBotSensors, visuBotTemplates, VisuBotView, worldChooserHTML, worldChosen, type WorldChoice } from './visubotView'
47+
import { mbotLinkText, setVisuBotMode, setVisuFlowWorld, setVisuObjectWorld, visuBotBrand, toggleMBotLink, visuBotEnabled, visuBotGroupColor, visuBotMode, visuBotSensors, visuBotTemplates, VisuBotView, worldChooserHTML, worldChosen, type WorldChoice } from './visubotView'
4848
import { canConnectMBot, mbotLink } from '../core/mbotLink'
4949
import { uploadToMBot } from './mbotUpload'
5050
import { lessons, tasks, useVisuBotContent, world } from '../learn/content'
@@ -744,6 +744,7 @@ export class App {
744744
const groupTitle = (list: HTMLUListElement, group: string) => {
745745
const li = document.createElement('li')
746746
li.className = 'palette-group'
747+
li.dataset.botColor = visuBotGroupColor(group)
747748
const button = document.createElement('button')
748749
button.type = 'button'
749750
button.textContent = t(`web_visubot_group_${group}`)
@@ -765,7 +766,11 @@ export class App {
765766
const grouped = <T extends { group: string }>(list: HTMLUListElement, items: T[], add: (item: T) => HTMLElement) => {
766767
for (const group of new Set(items.map((i) => i.group))) {
767768
const apply = groupTitle(list, group)
768-
for (const item of items.filter((i) => i.group === group)) add(item).dataset.group = group
769+
for (const item of items.filter((i) => i.group === group)) {
770+
const el = add(item)
771+
el.dataset.group = group
772+
el.dataset.botColor = visuBotGroupColor(group)
773+
}
769774
apply()
770775
}
771776
}

0 commit comments

Comments
 (0)