import { problemaPorId } from "./problemas"; import type { Partida } from "./tipos"; import { LINHAS_DO_FEED } from "./valores"; type ComFeed = Pick; export function registrar(p: ComFeed, texto: string): void { p.feed.push({ passo: p.passo, texto }); if (p.feed.length > LINHAS_DO_FEED) { p.feed.splice(0, p.feed.length - LINHAS_DO_FEED); } } export function registrarEliminacao( p: ComFeed, problemaDoDrone: string, problemaDoZumbi: string, ): void { const solucao = problemaPorId(problemaDoDrone)?.solucao ?? problemaDoDrone; const nome = problemaPorId(problemaDoZumbi)?.nome ?? problemaDoZumbi; registrar(p, `${solucao} eliminou ${nome}`); } export function registrarResolvido(p: ComFeed, problemaId: string): void { registrar(p, `Resolvido: ${problemaPorId(problemaId)?.nome ?? problemaId}`); }