Update 2023/Day2/part2.js
This commit is contained in:
parent
f8b43904f3
commit
7c0f5d9652
|
@ -9,13 +9,6 @@ var maxes = {
|
||||||
blue:14
|
blue:14
|
||||||
};
|
};
|
||||||
|
|
||||||
//var sum=0;
|
|
||||||
//for(var gameid=1;gameid<=games.length;++gameid) {
|
|
||||||
// var game = games[gameid-1];
|
|
||||||
// var bad = game.some(sample=>sample.some(([count,color])=>count>maxes[color]));
|
|
||||||
// if(!bad) sum+=gameid;
|
|
||||||
//}
|
|
||||||
|
|
||||||
var allpower = games.reduce((acc,game)=>{
|
var allpower = games.reduce((acc,game)=>{
|
||||||
var base={red:0,blue:0,green:0};
|
var base={red:0,blue:0,green:0};
|
||||||
game.forEach(sample=>sample.forEach(([count,color])=>base[color]=Math.max(base[color],count)));
|
game.forEach(sample=>sample.forEach(([count,color])=>base[color]=Math.max(base[color],count)));
|
||||||
|
|
Loading…
Reference in New Issue