EU-Werkstatt: Probierzuege (Karten rausziehen) erfassen + Sterne ehrlicher
Bisher konnte man Karten in Slots einsetzen und wieder herausziehen, bis alle voll waren — erst dann wurde ausgewertet. Dieses Herumprobieren war unsichtbar und senkte die Sterne nicht (5 Sterne trotz Trial-and-Error). - game.html: reshufflesByStep/totalReshuffles; manuelles Herausziehen einer platzierten Karte zaehlt als Probierzug. Ein Schritt gilt nur ohne Probierzuege als 'sauber auf Anhieb' -> Sterne (firstTryHits/steps) und Treffsicher-Achievement spiegeln Trial-and-Error jetzt. Endbild zeigt '🔄 N Probierzuege'; Live-State + Submit tragen die Zahlen. - teacher.html: needsHelp eu-werkstatt auch bei vielen Probierzuegen; '🔄 Probier'-Spalte in Aktuell; Run-Karte: Gesamt-Probierzuege + pro Schritt ('🔄 nach Probieren' statt 'auf Anhieb'). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4036,6 +4036,8 @@ const state = {
|
||||
muelleimerCount: 0,
|
||||
attemptsByStep: [], // Index = stepIndex, Wert = Anzahl Versuche
|
||||
detoursByStep: [], // Index = stepIndex, Wert = [{label, cardId?}, ...] — Mülleimer-Picks
|
||||
reshufflesByStep: [], // Index = stepIndex, Wert = Anzahl manuell wieder herausgezogener Karten (Probierzüge)
|
||||
totalReshuffles: 0,
|
||||
startedAt: 0,
|
||||
};
|
||||
|
||||
@@ -4293,9 +4295,19 @@ function resetTracking() {
|
||||
state.muelleimerCount = 0;
|
||||
state.attemptsByStep = [];
|
||||
state.detoursByStep = [];
|
||||
state.reshufflesByStep = [];
|
||||
state.totalReshuffles = 0;
|
||||
state.startedAt = Date.now();
|
||||
}
|
||||
|
||||
// Probierzug: Schüler:in zieht eine bereits platzierte Karte wieder aus dem
|
||||
// Slot. Zeichen von Unsicherheit/Trial-and-Error — zählt pro Schritt und
|
||||
// verhindert, dass der Schritt als „sauber auf Anhieb" gewertet wird.
|
||||
function registerReshuffle() {
|
||||
state.reshufflesByStep[state.stepIndex] = (state.reshufflesByStep[state.stepIndex] || 0) + 1;
|
||||
state.totalReshuffles++;
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
AKTUELLEN SCHRITT RENDERN
|
||||
========================================================= */
|
||||
@@ -4370,7 +4382,7 @@ function renderPickStep(area, step) {
|
||||
// Slot-Klick = Karte rauswerfen
|
||||
document.getElementById('slot-0').addEventListener('click', () => {
|
||||
if (state.answered) return;
|
||||
if (state.slotState[0].cardId) clearSlot(0);
|
||||
if (state.slotState[0].cardId) { registerReshuffle(); clearSlot(0); }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4399,7 +4411,7 @@ function renderSentenceStep(area, step) {
|
||||
step.slots.forEach((_, i) => {
|
||||
document.getElementById(`slot-${i}`).addEventListener('click', () => {
|
||||
if (state.answered) return;
|
||||
if (state.slotState[i].cardId) clearSlot(i);
|
||||
if (state.slotState[i].cardId) { registerReshuffle(); clearSlot(i); }
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4720,7 +4732,9 @@ function evaluateStep() {
|
||||
// === Tracking ===
|
||||
state.totalAttempts++;
|
||||
state.attemptsByStep[state.stepIndex] = (state.attemptsByStep[state.stepIndex] || 0) + 1;
|
||||
if (correct && state.attemptsByStep[state.stepIndex] === 1) {
|
||||
// Sauberer Erstversuch NUR ohne Probierzüge (Karten rein-/rausgezogen) auf
|
||||
// diesem Schritt — sonst war es Trial-and-Error, kein „auf Anhieb".
|
||||
if (correct && state.attemptsByStep[state.stepIndex] === 1 && !state.reshufflesByStep[state.stepIndex]) {
|
||||
state.firstTryHits++;
|
||||
}
|
||||
|
||||
@@ -4956,6 +4970,7 @@ function showEnd() {
|
||||
<div class="stats-row">
|
||||
<span><strong>${state.firstTryHits}</strong>/${stepsTotal} auf Anhieb richtig</span>
|
||||
<span><strong>${state.totalAttempts}</strong> Versuche</span>
|
||||
${state.totalReshuffles > 0 ? `<span>🔄 <strong>${state.totalReshuffles}</strong> Probierzüge</span>` : ''}
|
||||
${state.muelleimerCount > 0 ? `<span><strong>${state.muelleimerCount}×</strong> im Mülleimer</span>` : ''}
|
||||
</div>
|
||||
`;
|
||||
@@ -5017,6 +5032,8 @@ function showEnd() {
|
||||
muelleimerCount: state.muelleimerCount,
|
||||
attemptsByStep: state.attemptsByStep,
|
||||
detoursByStep: state.detoursByStep,
|
||||
reshufflesByStep: state.reshufflesByStep,
|
||||
totalReshuffles: state.totalReshuffles,
|
||||
difficulty: state.difficulty,
|
||||
newAchievements,
|
||||
},
|
||||
@@ -5275,13 +5292,14 @@ window.GGS_LIVE_STATE = function () {
|
||||
var stepIdx = state.stepIndex || 0;
|
||||
var currentStep = (state.scenario && state.scenario.steps) ? state.scenario.steps[stepIdx] : null;
|
||||
var attemptsThisStep = (state.attemptsByStep && state.attemptsByStep[stepIdx]) || 0;
|
||||
var reshufflesThisStep = (state.reshufflesByStep && state.reshufflesByStep[stepIdx]) || 0;
|
||||
var secondsElapsed = state.startedAt ? Math.round((Date.now() - state.startedAt) / 1000) : 0;
|
||||
|
||||
// Health-Ampel (für die Lehrer-Live-Übersicht der nächsten Phase)
|
||||
var health = 'good';
|
||||
if (screen === 'play') {
|
||||
if (state.muelleimerCount >= 3 || attemptsThisStep >= 3) health = 'struggling';
|
||||
else if (state.muelleimerCount >= 1 || attemptsThisStep >= 2) health = 'ok';
|
||||
if (state.muelleimerCount >= 3 || attemptsThisStep >= 3 || reshufflesThisStep >= 4) health = 'struggling';
|
||||
else if (state.muelleimerCount >= 1 || attemptsThisStep >= 2 || reshufflesThisStep >= 2) health = 'ok';
|
||||
} else if (screen === 'end') {
|
||||
health = 'good';
|
||||
} else {
|
||||
@@ -5315,6 +5333,8 @@ window.GGS_LIVE_STATE = function () {
|
||||
totalAttempts: state.totalAttempts || 0,
|
||||
muelleimerCount: state.muelleimerCount || 0,
|
||||
attemptsThisStep: attemptsThisStep,
|
||||
reshuffles: state.totalReshuffles || 0,
|
||||
reshufflesThisStep: reshufflesThisStep,
|
||||
secondsElapsed: secondsElapsed,
|
||||
achievementsUnlocked: Object.keys(ach).length,
|
||||
achievementsTotal: (typeof ACHIEVEMENTS !== 'undefined') ? ACHIEVEMENTS.length : 6,
|
||||
|
||||
+15
-4
@@ -810,6 +810,11 @@ var LIVE_PRIMARY_FIELDS = {
|
||||
var color = v === 0 ? '#5a8a5e' : v >= 3 ? '#c07a6b' : '#c9913a';
|
||||
return '<span style="color:'+color+';font-weight:700">'+v+'</span>';
|
||||
}},
|
||||
{k:'reshuffles', label:'🔄 Probier', align:'center', fmt:function(v){
|
||||
if (!v) return '<span style="color:#8a8a8a">–</span>';
|
||||
var color = v >= 5 ? '#c07a6b' : v >= 2 ? '#c9913a' : '#5a8a5e';
|
||||
return '<span style="color:'+color+';font-weight:700">'+v+'</span>';
|
||||
}},
|
||||
{k:'secondsElapsed', label:'Dauer', fmt:function(v){ return v ? _fmtSeconds(v) : '—'; }},
|
||||
{k:'achievementsUnlocked', label:'Erfolge', fmt:function(v, row){
|
||||
var s = row.state || {};
|
||||
@@ -1281,7 +1286,7 @@ function _liveNeedsHelp(simId, s) {
|
||||
case 'weltkueche': return (s.mistakesInDish||0) >= 12;
|
||||
case 'farmer': return (s.cash==null?1000:s.cash) < 0 || ((s.attempts||0) >= 6 && s.hit_rate != null && s.hit_rate < 30);
|
||||
case 'logistik': return (s.balance==null?1000:s.balance) < 0;
|
||||
case 'eu-werkstatt': return (s.attemptsThisStep||0) >= 6;
|
||||
case 'eu-werkstatt': return (s.attemptsThisStep||0) >= 6 || (s.reshufflesThisStep||0) >= 5;
|
||||
case 'energiemanager': return (s.blackouts||0) >= 2 || (s.phase === 'done' && (s.balanced||0) < 4);
|
||||
case 'tourismustal': return (s.money==null?1:s.money) < 0 || (s.lossStreak||0) >= 8;
|
||||
case 'tourismusregion': return (s.budget==null?1:s.budget) < -400 || (s.env==null?100:s.env) < 30;
|
||||
@@ -5192,18 +5197,23 @@ function renderEuWerkstattRun(dt, dur, r, d) {
|
||||
var stepsTotal = d.stepsTotal || 0;
|
||||
var attempts = d.attemptsByStep || [];
|
||||
var detours = d.detoursByStep || [];
|
||||
var reshuffles = d.reshufflesByStep || [];
|
||||
// Schritt-für-Schritt-Tabelle
|
||||
var stepRows = '';
|
||||
for (var i = 0; i < stepsTotal; i++) {
|
||||
var n = attempts[i] || 1;
|
||||
var firstTry = (n === 1);
|
||||
var rs = reshuffles[i] || 0;
|
||||
var clean = (n === 1 && !rs); // sauber = ein Zug, kein Herumprobieren
|
||||
var stepDet = (detours[i] || []).map(function(x){
|
||||
var ic = x.kind === 'muelleimer' ? '🗑️' : '🔁';
|
||||
return '<span class="run-detour '+(x.kind === 'muelleimer'?'kind-muelleimer':'kind-soft')+'">'+ic+' '+esc(x.label||'')+'</span>';
|
||||
}).join('');
|
||||
var tag = firstTry
|
||||
if (rs > 0) stepDet += '<span class="run-detour kind-soft">🔄 '+rs+' Probierzug'+(rs===1?'':'e')+'</span>';
|
||||
var tag = clean
|
||||
? '<span style="color:#5a8a5e;font-weight:700">✓ auf Anhieb</span>'
|
||||
: '<span style="color:#c9913a;font-weight:700">'+n+'. Versuch</span>';
|
||||
: (n > 1
|
||||
? '<span style="color:#c9913a;font-weight:700">'+n+'. Versuch</span>'
|
||||
: '<span style="color:#c9913a;font-weight:700">🔄 nach Probieren</span>');
|
||||
stepRows += '<tr><td style="width:2em;color:#8a8a8a">'+(i+1)+'.</td><td>'+tag+'</td><td>'+(stepDet||'—')+'</td></tr>';
|
||||
}
|
||||
return ''
|
||||
@@ -5217,6 +5227,7 @@ function renderEuWerkstattRun(dt, dur, r, d) {
|
||||
+ '<div class="run-stats">'
|
||||
+ '<span><b>'+(d.firstTryHits||0)+'</b>/'+stepsTotal+' auf Anhieb</span>'
|
||||
+ '<span><b>'+(d.totalAttempts||0)+'</b> Versuche</span>'
|
||||
+ ((d.totalReshuffles||0)>0 ? '<span>🔄 <b>'+d.totalReshuffles+'</b> Probierzüge</span>' : '')
|
||||
+ '<span><b>'+(d.muelleimerCount||0)+'</b> Mülleimer</span>'
|
||||
+ '</div>'
|
||||
+ (stepRows
|
||||
|
||||
Reference in New Issue
Block a user