Skip to content

Commit 108331b

Browse files
stho32claude
andcommitted
docs: Update math-bot scenarios with Emitter mode examples
- Completely rewrote math-calculation-bots.md with three variants: - Variant 1: Modern solution using Emitter mode - Variant 2: Full automatic solution with multiple bots - Variant 3: Task-based distributed calculation - Updated quickstart guide with Emitter as the primary option - Added practical examples for Python and PowerShell - Included troubleshooting section and extension ideas - Added emoji for better visual feedback 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 5c5ffff commit 108331b

File tree

2 files changed

+446
-136
lines changed

2 files changed

+446
-136
lines changed

docs/quickstart-math-bots.md

Lines changed: 157 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,116 +2,215 @@
22

33
Eine schnelle Anleitung, um das Mathe-Bot-System zum Laufen zu bringen.
44

5-
## Schritt 1: Scripts vorbereiten
5+
## Option 1: Einfachste Variante mit Emitter (NEU!)
66

7-
Erstellen Sie einen Ordner `math-scripts` und fügen Sie diese Dateien hinzu:
7+
### Schritt 1: Generator-Script erstellen
88

9-
### math-scripts/generate.ps1
9+
Erstellen Sie `math-generator.py`:
10+
11+
```python
12+
import random
13+
import time
14+
15+
print("🧮 Math Generator startet...")
16+
while True:
17+
a = random.randint(1, 10)
18+
b = random.randint(1, 10)
19+
print(f"{a} + {b} = ?")
20+
time.sleep(3)
21+
```
22+
23+
### Schritt 2: Server und Emitter starten
24+
25+
**Terminal 1 - Server:**
26+
```bash
27+
LocalNetAppChat.Server --port 5000 --key "demo"
28+
```
29+
30+
**Terminal 2 - Emitter (Generator):**
31+
```bash
32+
LocalNetAppChat.ConsoleClient emitter \
33+
--server localhost --port 5000 --key "demo" \
34+
--clientName "MathGenerator" \
35+
--command "python math-generator.py"
36+
```
37+
38+
**Terminal 3 - Beobachter:**
39+
```bash
40+
LocalNetAppChat.ConsoleClient listener \
41+
--server localhost --port 5000 --key "demo" \
42+
--clientName "Observer"
43+
```
44+
45+
### Was Sie sehen werden
46+
47+
Im Observer-Terminal erscheinen alle 3 Sekunden neue Aufgaben:
48+
49+
```
50+
[15:30:45] MathGenerator: 🧮 Math Generator startet...
51+
[15:30:48] MathGenerator: 7 + 4 = ?
52+
[15:30:51] MathGenerator: 3 + 8 = ?
53+
[15:30:54] MathGenerator: 9 + 2 = ?
54+
```
55+
56+
## Option 2: Interaktive Variante mit Bots
57+
58+
### Schritt 1: Scripts vorbereiten
59+
60+
Erstellen Sie einen Ordner `math-scripts` mit diesen Dateien:
61+
62+
**math-scripts/generate.ps1:**
1063
```powershell
1164
$a = Get-Random -Minimum 0 -Maximum 11
1265
$b = Get-Random -Minimum 0 -Maximum 11
1366
Write-Output "$a + $b = ?"
1467
```
1568

16-
### math-scripts/calculate.ps1
69+
**math-scripts/calculate.ps1:**
1770
```powershell
1871
param([string]$input)
1972
if ($input -match "(\d+)\s*\+\s*(\d+)") {
2073
$result = [int]$matches[1] + [int]$matches[2]
21-
Write-Output "Result: $result"
74+
Write-Output "✅ Antwort: $result"
2275
if ($result -gt 10) {
23-
Write-Output "WOW! That's more than 10!"
76+
Write-Output "🎉 WOW! Das ist mehr als 10!"
2477
}
2578
}
2679
```
2780

28-
## Schritt 2: Alles starten
29-
30-
Öffnen Sie 4 Terminal-Fenster:
81+
### Schritt 2: Alles starten
3182

3283
**Terminal 1 - Server:**
3384
```bash
3485
LocalNetAppChat.Server --port 5000 --key "demo"
3586
```
3687

37-
**Terminal 2 - Generator Bot:**
88+
**Terminal 2 - Calculator Bot:**
3889
```bash
39-
LocalNetAppChat.Bot --server localhost --port 5000 --key "demo" --clientName "GeneratorBot" --scriptspath "./math-scripts"
90+
LocalNetAppChat.Bot --server localhost --port 5000 --key "demo" \
91+
--clientName "CalculatorBot" --scriptspath "./math-scripts"
4092
```
4193

42-
**Terminal 3 - Calculator Bot:**
94+
**Terminal 3 - Observer:**
4395
```bash
44-
LocalNetAppChat.Bot --server localhost --port 5000 --key "demo" --clientName "CalculatorBot" --scriptspath "./math-scripts"
96+
LocalNetAppChat.ConsoleClient listener --server localhost --port 5000 --key "demo" \
97+
--clientName "Observer"
4598
```
4699

47-
**Terminal 4 - Observer:**
100+
**Terminal 4 - Chat (Controller):**
48101
```bash
49-
LocalNetAppChat.ConsoleClient listener --server localhost --port 5000 --key "demo" --clientName "Observer"
102+
LocalNetAppChat.ConsoleClient chat --server localhost --port 5000 --key "demo" \
103+
--clientName "Teacher"
50104
```
51105

52-
## Schritt 3: Die Show starten
106+
### Schritt 3: Bots verwenden
53107

54-
Öffnen Sie ein 5. Terminal für den Chat:
55-
```bash
56-
LocalNetAppChat.ConsoleClient chat --server localhost --port 5000 --key "demo" --clientName "Controller"
57-
```
108+
Im Chat-Terminal eingeben:
58109

59-
Geben Sie im Chat ein:
60110
```
61-
/msg GeneratorBot exec generate.ps1
111+
/msg CalculatorBot exec calculate.ps1 "7 + 4"
62112
```
63113

64-
## Was Sie sehen werden
65-
66-
Im Observer-Fenster erscheint:
114+
Ausgabe im Observer:
67115
```
68-
[2024-01-20 15:30:45] GeneratorBot: 7 + 4 = ?
116+
[15:35:10] CalculatorBot: ✅ Antwort: 11
117+
[15:35:10] CalculatorBot: 🎉 WOW! Das ist mehr als 10!
69118
```
70119

71-
Jetzt können Sie den Calculator triggern:
72-
```
73-
/msg CalculatorBot exec calculate.ps1 "7 + 4"
74-
```
120+
## Option 3: Vollautomatisch mit Emitter + Bot
75121

76-
Ausgabe:
77-
```
78-
[2024-01-20 15:30:50] CalculatorBot: Result: 11
79-
[2024-01-20 15:30:50] CalculatorBot: WOW! That's more than 10!
80-
```
122+
### Generator mit Bot-Kommunikation
81123

82-
## Automatisierung
124+
Erstellen Sie `auto-math.py`:
83125

84-
Für kontinuierliche Generierung, erstellen Sie `auto-generate.ps1`:
85-
```powershell
86-
while($true) {
87-
$a = Get-Random -Minimum 0 -Maximum 11
88-
$b = Get-Random -Minimum 0 -Maximum 11
89-
Write-Output "/msg CalculatorBot exec calculate.ps1 `"$a + $b`""
90-
Start-Sleep -Seconds 3
91-
}
92-
```
126+
```python
127+
import random
128+
import time
93129

94-
Und starten Sie es:
130+
print("🤖 Auto-Math System gestartet...")
131+
while True:
132+
a = random.randint(1, 10)
133+
b = random.randint(1, 10)
134+
# Direkt an den Calculator-Bot senden
135+
print(f'/msg CalculatorBot exec calculate.ps1 "{a} + {b}"')
136+
time.sleep(5)
95137
```
96-
/msg GeneratorBot exec auto-generate.ps1
138+
139+
Starten Sie den Emitter:
140+
141+
```bash
142+
LocalNetAppChat.ConsoleClient emitter \
143+
--server localhost --port 5000 --key "demo" \
144+
--clientName "AutoMath" \
145+
--command "python auto-math.py"
97146
```
98147

148+
Jetzt werden automatisch Aufgaben generiert UND gelöst!
149+
99150
## Troubleshooting
100151

101-
**Problem:** "Access denied"
102-
- Lösung: Prüfen Sie, ob alle Komponenten denselben Key verwenden
152+
**Problem:** "Connection refused"
153+
- Server läuft nicht → Server zuerst starten
154+
- Falscher Port → Port 5000 verwenden
103155

104156
**Problem:** Bot reagiert nicht
105-
- Lösung: Stellen Sie sicher, dass der Bot läuft und der Name korrekt ist
157+
- Bot-Name falsch → Exakten Namen in `/msg` verwenden
158+
- Bot läuft nicht → Bot-Terminal prüfen
106159

107-
**Problem:** Scripts werden nicht gefunden
108-
- Lösung: Prüfen Sie den `--scriptspath` Parameter
160+
**Problem:** Keine Ausgabe vom Emitter
161+
- Python nicht gefunden → `python3` statt `python` versuchen
162+
- Script-Fehler → Script direkt testen
109163

110-
## Nächste Schritte
164+
## Coole Erweiterungen
165+
166+
### 1. Multiplikations-Trainer
111167

112-
- Fügen Sie mehr Mathematik-Operationen hinzu
113-
- Erstellen Sie einen Statistik-Bot
114-
- Implementieren Sie ein Punkte-System
115-
- Erweitern Sie auf Algebra-Aufgaben
168+
```python
169+
# multiply.py
170+
import random
171+
import time
172+
173+
while True:
174+
a = random.randint(2, 9)
175+
b = random.randint(2, 9)
176+
print(f"{a} × {b} = ?")
177+
time.sleep(4)
178+
```
179+
180+
### 2. Countdown-Timer
181+
182+
```python
183+
# countdown.py
184+
import time
185+
186+
for i in range(10, 0, -1):
187+
print(f"⏰ Countdown: {i}")
188+
time.sleep(1)
189+
print("🚀 START!")
190+
```
191+
192+
### 3. Statistik-Sammler
193+
194+
```python
195+
# stats.py
196+
count = 0
197+
while True:
198+
count += 1
199+
print(f"📊 Nachricht #{count} gesendet")
200+
time.sleep(2)
201+
```
202+
203+
## Zusammenfassung
204+
205+
Mit dem neuen Emitter-Modus brauchen Sie nur:
206+
1. Ein Python/PowerShell-Script das Ausgaben erzeugt
207+
2. Den Emitter-Client der diese streamt
208+
3. Einen Observer zum Anschauen
209+
210+
Das war's! In unter 5 Minuten haben Sie ein funktionierendes System. 🎉
211+
212+
## Nächste Schritte
116213

117-
Viel Spaß beim Experimentieren! 🎉
214+
- Probieren Sie die Task-System-Variante aus dem [vollständigen Math-Bot-Tutorial](./scenarios/math-calculation-bots.md)
215+
- Erkunden Sie andere [Szenarien](./scenarios/README.md)
216+
- Bauen Sie eigene kreative Anwendungen!

0 commit comments

Comments
 (0)