function possibleGames(games) {
const [minR, minG, minB] = [12, 13, 14];
const notAbove = (x, cap) => x === undefined || x <= cap;
return Object.entries(games).reduce((total, [id, game]) => {
const possible = game.every(
(round) =>
notAbove(round.red, minR) &&
notAbove(round.green, minG) &&
notAbove(round.blue, minB)
);
return total + (possible ? +id : 0);
}, 0);
}