Weltkueche Heimat-Regel ehrlich: regionale Gerichte haben Heimat + realistische EU-Nachbar-Produzenten als korrekt (immer >=2 Optionen), ferne/klimafremde bleiben Distraktoren

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-18 12:02:22 +02:00
parent b9bcbf9198
commit 9ec7ad67f1
+40 -7
View File
@@ -994,18 +994,51 @@ function buildTaskFor(ingKey) {
const _hDish = current && current.dish;
const heimat = _hDish && _hDish.heimat;
if (heimat && C[heimat] && ing.producers && ing.producers[heimat]) {
const correct = [heimat];
const others = Object.entries(ing.producers)
.filter(([c]) => C[c] && c !== heimat)
// Heimat ist immer korrekt (lokal). ZUSÄTZLICH gelten die realistischen
// EU-/Nachbar-Produzenten als ebenso korrekt — man nimmt AT-Eier, aber
// dt./schweizer/it. wären genauso plausibel. Den Lokal-Vorteil holt die
// CO₂-/Transport-Bilanz, nicht der Korrekt-Slot. Ferne/klimafremde Länder
// (z. B. Südamerika) bleiben Distraktoren.
// Realistische Zweit-Produzenten: EU-Markt zuerst, dann Weltmarkt-in-unseren-Regalen
// (global/ungetaggt). „world-far"/„local" (wächst dort, landet aber nicht in unseren
// Regalen) zählen NICHT als korrekt.
const mrank = m => (m === 'eu' ? 0 : (m === 'world-far' || m === 'local') ? 2 : 1);
const realistic = Object.entries(ing.producers)
.filter(([c, info]) => C[c] && c !== heimat && mrank(info.market) < 2)
.sort((a, b) => (mrank(a[1].market) - mrank(b[1].market)) || ((b[1].t || 0) - (a[1].t || 0)))
.map(([c]) => c);
const correct = [heimat, ...realistic.slice(0, 2)];
if (correct.length < 2) { // Garantie: es gibt IMMER eine zweite Wahl
const any = Object.entries(ing.producers)
.filter(([c]) => C[c] && c !== heimat && !correct.includes(c))
.sort((a, b) => (b[1].t || 0) - (a[1].t || 0)).map(([c]) => c);
if (any[0]) correct.push(any[0]);
}
// Distraktoren: ferne Produzenten (world-far/local) + klar klimafremde Länder.
const farProducers = Object.entries(ing.producers)
.filter(([c, info]) => C[c] && !correct.includes(c) && mrank(info.market) === 2)
.sort((a, b) => (b[1].t || 0) - (a[1].t || 0))
.map(([c]) => c);
const climatePossible = (ing.climate_possible || []).filter(c => C[c] && c !== heimat);
const distr = others.slice(0, 3);
if (climatePossible.length && distr.length < 3) distr.push(climatePossible[0]);
const climatePossible = (ing.climate_possible || []).filter(c => C[c] && !correct.includes(c));
const impossible = impossibleCountries(correct, [...farProducers, ...climatePossible, ...Object.keys(ing.producers)]);
shuffleInPlace(farProducers); shuffleInPlace(climatePossible); shuffleInPlace(impossible);
const distr = [];
if (farProducers[0]) distr.push(farProducers[0]); // wächst dort, aber weit weg
for (const c of [...impossible, ...climatePossible]) { // klimafremd / kein Markt
if (distr.length >= 3) break;
if (!distr.includes(c) && !correct.includes(c)) distr.push(c);
}
const choices = [...correct, ...distr];
shuffleInPlace(choices);
const label = (_hDish.signature && _hDish.signature[ingKey]) || null;
_taskCache[ingKey] = { correct, choices, possible: new Set(), signature: true, heimat, label };
_taskCache[ingKey] = {
correct, choices,
possible: new Set(distr.filter(c => (ing.climate_possible || []).includes(c))),
signature: true, heimat, label
};
return _taskCache[ingKey];
}
// Alle Producer (für Klassifizierung) und EU-relevante separat (für Korrekt-Auswahl).