Your mission
When a value evolves across several stages, we use an accumulator variable declared with let and update it progressively with the compound assignment operators += and -=. Once all updates are complete, we can compute derived constants with const.
In input, you receive an object describing a participant's performance in a coding competition:
jugador: participant's name (non-empty string of 1 to 40 characters).
puntosIniciales: starting score for the round (0 to 10000).
puntosGanados: points earned by solving challenges (0 to 5000).
puntosPenalizacion: points deducted for failed submissions (0 up to puntosIniciales + puntosGanados).
puntosBonus: bonus points for speed or streaks (0 to 2000).
Apply the operations in this exact order on an accumulator variable:
- Start with
puntosIniciales.
- Add
puntosGanados (+=).
- Subtract
puntosPenalizacion (-=).
- Add
puntosBonus (+=).
Finally, return an object with exactly four properties:
jugador: the original player name received.
puntosFinales: the resulting score after applying all operations.
puntosNetos: the net score change relative to the start (puntosFinales - puntosIniciales).
superoMarca: a boolean (true or false) that is true only when puntosFinales > puntosIniciales.
Rules and constraints
- Valid inputs and bounds: all numbers are integers within the stated ranges, and the score after subtracting the penalty never drops below
0.
- Strict comparison: tying the initial score (
puntosFinales === puntosIniciales) does not count as beating the mark (superoMarca must be false).
- Allowed tools: use
let, const, compound assignment operators (+=, -=), subtraction (-), direct comparison (>), and return. Do not use conditionals (if / ternary), loops, arrays, classes, or helper functions.
Contract
Complete function solve(input) and return the resulting object. The input always satisfies the described constraints. Do not use network calls, files, imports, packages, or asynchronous code.