fivetech commited on
Commit
1db5dd1
·
verified ·
1 Parent(s): 235196b

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +8 -8
app.js CHANGED
@@ -719,7 +719,7 @@ async function judgeTournamentMatch(mi) {
719
  }
720
  m.winner = w ? battle.participants.indexOf(w) : null;
721
  addSystemMsg(w ? `✅ ${m.name}: avanza ${w.name} (${Math.max(tA, tB)} vs ${Math.min(tA, tB)})` : `⚠️ ${m.name}: sin ganador fiable (evaluación no disponible)`);
722
- if (!jr.heuristic) {
723
  pair.forEach(a => {
724
  const st = stats[a.id] = stats[a.id] || { wins: 0, losses: 0, draws: 0, scoreSum: 0, matches: 0, awards: {} };
725
  st.matches++; st.scoreSum += totalScore(a.id, jr.scores);
@@ -739,7 +739,7 @@ function finalizeTournament() {
739
  battle.heuristicEval = t.matches.some(m => m.heuristic || m.skipped);
740
  battle.finishedAt = new Date().toISOString();
741
  matches.unshift({ id: battle.id, topic: battle.topic, mode: battle.mode, rounds: battle.rounds, participants: battle.participants.map(a => a.id),
742
- events: battle.events, winner: battle.winner, heuristic: battle.heuristicEval,
743
  tournament: t.matches.map(m => ({ name: m.name, a: m.a, b: m.b, winner: m.winner, totalA: m.totalA, totalB: m.totalB, heuristic: !!m.heuristic, skipped: !!m.skipped })),
744
  date: battle.finishedAt });
745
  if (matches.length > 50) matches.length = 50;
@@ -777,8 +777,8 @@ function finalizeBattle(verdict) {
777
  battle.winnerTeam = winnerTeam;
778
  battle.verdict = verdict;
779
  battle.finishedAt = new Date().toISOString();
780
- // stats: solo cuentan batallas con evaluación real del modelo (no heurísticas)
781
- if (!battle.heuristicEval) {
782
  ps.forEach(a => {
783
  const st = stats[a.id] = stats[a.id] || { wins: 0, losses: 0, draws: 0, scoreSum: 0, matches: 0, awards: {} };
784
  st.matches++;
@@ -793,7 +793,7 @@ function finalizeBattle(verdict) {
793
  });
794
  }
795
  // guardar batalla (Arena Memory)
796
- matches.unshift({ id: battle.id, topic: battle.topic, mode: battle.mode, rounds: battle.rounds, participants: ps.map(a => a.id), teams: battle.mode === 'team' ? Object.fromEntries(ps.map(a => [a.id, a.team])) : undefined, events: battle.events, scores: battle.scores, winner: battle.winner, winnerTeam, verdict, heuristic: !!battle.heuristicEval, date: battle.finishedAt });
797
  if (matches.length > 50) matches.length = 50;
798
  persistAll();
799
  renderResults(totals, winner, verdict);
@@ -1066,7 +1066,7 @@ function renderHall() {
1066
  return `<div class="match-item" data-match="${m.id}">
1067
  <div class="mtopic">${esc(m.topic)}</div>
1068
  <div class="mmeta">${MODES.find(x => x.id === m.mode)?.name || m.mode} · ${m.events.length} intervenciones · ${new Date(m.date).toLocaleString('es')}</div>
1069
- <div class="mmeta">${m.heuristic ? '⚠️ sin evaluación fiable (no cuenta para el Hall)' : (m.mode === 'tournament' ? '🏆 Campeón: ' + (w ? esc(w.name) : '—') : m.winnerTeam ? '🛡️ Equipo ' + m.winnerTeam : '👑 ' + (w ? esc(w.name) : 'Empate'))}</div>
1070
  <button class="btn ghost small" data-replay="${m.id}">▶ Replay</button>
1071
  </div>`;
1072
  }).join('') : '<p style="color:var(--muted);font-size:.85rem">Aún no hay batallas guardadas.</p>';
@@ -1083,14 +1083,14 @@ async function startReplay(matchId) {
1083
  renderPhaseTrack('verdict');
1084
  renderFighters(null);
1085
  $('#battle-log').innerHTML = '';
1086
- addSystemMsg(`▶ REPLAY — ${m.topic} (${new Date(m.date).toLocaleString('es')})`);
1087
  if (replayTimer) clearInterval(replayTimer);
1088
  let i = 0, lastMatch = null;
1089
  replayTimer = setInterval(() => {
1090
  if (i >= m.events.length) {
1091
  clearInterval(replayTimer); replayTimer = null;
1092
  const w = m.winner ? agentById(m.winner) : null;
1093
- addSystemMsg(m.mode === 'tournament' ? (w ? `🏆 Campeón: ${w.name}` : '⚠️ Torneo sin campeón fiable') : m.winnerTeam ? `🛡️ Ganador: Equipo ${m.winnerTeam}` : (w ? `👑 Ganador: ${w.name}` : '🤝 Empate'));
1094
  return;
1095
  }
1096
  const ev = m.events[i++];
 
719
  }
720
  m.winner = w ? battle.participants.indexOf(w) : null;
721
  addSystemMsg(w ? `✅ ${m.name}: avanza ${w.name} (${Math.max(tA, tB)} vs ${Math.min(tA, tB)})` : `⚠️ ${m.name}: sin ganador fiable (evaluación no disponible)`);
722
+ if (!jr.heuristic && !MOCK) {
723
  pair.forEach(a => {
724
  const st = stats[a.id] = stats[a.id] || { wins: 0, losses: 0, draws: 0, scoreSum: 0, matches: 0, awards: {} };
725
  st.matches++; st.scoreSum += totalScore(a.id, jr.scores);
 
739
  battle.heuristicEval = t.matches.some(m => m.heuristic || m.skipped);
740
  battle.finishedAt = new Date().toISOString();
741
  matches.unshift({ id: battle.id, topic: battle.topic, mode: battle.mode, rounds: battle.rounds, participants: battle.participants.map(a => a.id),
742
+ events: battle.events, winner: battle.winner, heuristic: battle.heuristicEval, simulated: MOCK || undefined,
743
  tournament: t.matches.map(m => ({ name: m.name, a: m.a, b: m.b, winner: m.winner, totalA: m.totalA, totalB: m.totalB, heuristic: !!m.heuristic, skipped: !!m.skipped })),
744
  date: battle.finishedAt });
745
  if (matches.length > 50) matches.length = 50;
 
777
  battle.winnerTeam = winnerTeam;
778
  battle.verdict = verdict;
779
  battle.finishedAt = new Date().toISOString();
780
+ // stats: solo cuentan batallas con evaluación real del modelo (ni heurísticas ni simuladas)
781
+ if (!battle.heuristicEval && !MOCK) {
782
  ps.forEach(a => {
783
  const st = stats[a.id] = stats[a.id] || { wins: 0, losses: 0, draws: 0, scoreSum: 0, matches: 0, awards: {} };
784
  st.matches++;
 
793
  });
794
  }
795
  // guardar batalla (Arena Memory)
796
+ matches.unshift({ id: battle.id, topic: battle.topic, mode: battle.mode, rounds: battle.rounds, participants: ps.map(a => a.id), teams: battle.mode === 'team' ? Object.fromEntries(ps.map(a => [a.id, a.team])) : undefined, events: battle.events, scores: battle.scores, winner: battle.winner, winnerTeam, verdict, heuristic: !!battle.heuristicEval, simulated: MOCK || undefined, date: battle.finishedAt });
797
  if (matches.length > 50) matches.length = 50;
798
  persistAll();
799
  renderResults(totals, winner, verdict);
 
1066
  return `<div class="match-item" data-match="${m.id}">
1067
  <div class="mtopic">${esc(m.topic)}</div>
1068
  <div class="mmeta">${MODES.find(x => x.id === m.mode)?.name || m.mode} · ${m.events.length} intervenciones · ${new Date(m.date).toLocaleString('es')}</div>
1069
+ <div class="mmeta">${m.simulated ? '🧪 Resultado simulado (pruebas, sin modelo real)' : m.heuristic ? '⚠️ sin evaluación fiable (no cuenta para el Hall)' : (m.mode === 'tournament' ? '🏆 Campeón: ' + (w ? esc(w.name) : '—') : m.winnerTeam ? '🛡️ Equipo ' + m.winnerTeam : '👑 ' + (w ? esc(w.name) : 'Empate'))}</div>
1070
  <button class="btn ghost small" data-replay="${m.id}">▶ Replay</button>
1071
  </div>`;
1072
  }).join('') : '<p style="color:var(--muted);font-size:.85rem">Aún no hay batallas guardadas.</p>';
 
1083
  renderPhaseTrack('verdict');
1084
  renderFighters(null);
1085
  $('#battle-log').innerHTML = '';
1086
+ addSystemMsg(`▶ REPLAY — ${m.topic} (${new Date(m.date).toLocaleString('es')})${m.simulated ? ' · 🧪 SIMULADO (pruebas, sin modelo real)' : ''}`);
1087
  if (replayTimer) clearInterval(replayTimer);
1088
  let i = 0, lastMatch = null;
1089
  replayTimer = setInterval(() => {
1090
  if (i >= m.events.length) {
1091
  clearInterval(replayTimer); replayTimer = null;
1092
  const w = m.winner ? agentById(m.winner) : null;
1093
+ addSystemMsg((m.mode === 'tournament' ? (w ? `🏆 Campeón: ${w.name}` : '⚠️ Torneo sin campeón fiable') : m.winnerTeam ? `🛡️ Ganador: Equipo ${m.winnerTeam}` : (w ? `👑 Ganador: ${w.name}` : '🤝 Empate')) + (m.simulated ? ' · 🧪 SIMULADO (pruebas)' : ''));
1094
  return;
1095
  }
1096
  const ev = m.events[i++];