Hallo. Wir haben mit Hilfe von Claude 3.5 ein kleines „Fußball-Orakel“ für den Calliope 2 Mini erstellt. Siehe unten.
Das Programm läuft, wenn wir nur maximal 20 Spielergebnisse reinladen. Bei einer größeren Anzahl von Spielen, funktioniert das Programm zwar immernoch im Test im Browser (Desktop) oder auf dem iPad, auf dem Calliope flackert aber nur noch die LEDs kurz auf.
Kann mir jemand sagen, ob wir hier wirklich an das Speicherlimit kommen? Und wenn ja, dann würde mich interessieren, ob das mit dem Calliope 3 anders wäre.
Eigentlich war das Ziel alle Spiele des DFB Pokals reinzuladen. Vielleicht sogar in doppelt mit vertauschter Heim- und Auswärtsmannschaft. Das wären dann 2x63 Spiele.
Schöne Grüße
===
Funktionierender Code auf Calliope Mini 2:
let results = ["2:1","0:7","3:3","1:3","0:4","0:5","1:6","0:5","3:2","0:2","0:8","1:9","0:1","2:2","0:1","0:8","3:4","0:2","0:5","0:7"]
let penalties = ["","","4:2","","","","","","","","","","","4:1","","","","","",""]
let currentIndex = -1
// Function to pick a random match and show result
function showRandomResult() {
currentIndex = Math.randomRange(0, results.length - 1)
basic.showString(results[currentIndex])
}
// Function to show penalty result
function showPenaltyResult() {
if (currentIndex >= 0) {
if (penalties[currentIndex] !== "") {
basic.showString(penalties[currentIndex])
} else {
basic.showString(results[currentIndex])
}
}
}
// Display soccer ball at start
basic.showLeds(`
. # . # .
# . # . #
. # # # .
# . # . #
. # . # .
`)
basic.pause(1000)
basic.clearScreen()
// Button A: Pick random match and show result
input.onButtonPressed(Button.A, function() {
showRandomResult()
})
// Button B: Show penalty result if available
input.onButtonPressed(Button.B, function() {
showPenaltyResult()
})
// Shake: Show random "A" or "H"
input.onGesture(Gesture.Shake, function() {
if (Math.randomBoolean()) {
basic.showString("A")
} else {
basic.showString("H")
}
})
Fehlerhafter Code wäre:
let results = let results = ["2:1","0:7","3:3","1:3","0:4","0:5","1:6","0:5","3:2","0:2","0:8","1:9","0:1","2:2","0:1","0:8","3:4","0:2","0:5","0:7","1:3","0:6","2:0","1:1","0:4","0:7","0:3","1:4","1:2","1:3","0:4","2:3","2:1","2:1","1:0","1:0","1:1","3:6","3:1","3:2","2:5","3:3","1:3","1:0","0:2","2:1","3:2","3:0"]
let penalties = ["","","4:2","","","","","","","","","","","4:1","","","","","","","","","","0:3","","","","","","","","","","","","","3:4","","","","","3:4","","","","","",""]
let currentIndex = -1
[...]