Remove unnecessary code
This commit is contained in:
parent
fb7913ad3d
commit
0ca34d3bdc
@ -6,7 +6,7 @@ let
|
|||||||
totalsPerElf = map sum elfCalories;
|
totalsPerElf = map sum elfCalories;
|
||||||
|
|
||||||
part1 = maxList totalsPerElf;
|
part1 = maxList totalsPerElf;
|
||||||
part2 = sum (topOfList 3 (sortList totalsPerElf));
|
part2 = sum (take 3 (sortList totalsPerElf));
|
||||||
in {
|
in {
|
||||||
inherit part1;
|
inherit part1;
|
||||||
inherit part2;
|
inherit part2;
|
||||||
|
@ -28,7 +28,7 @@ let
|
|||||||
if b == 0 then mkLoss a
|
if b == 0 then mkLoss a
|
||||||
else if b == 1 then mkDraw a
|
else if b == 1 then mkDraw a
|
||||||
else mkWin a;
|
else mkWin a;
|
||||||
makeBestMoves = m: map (pair: split pair (a: b: [a (bestMove a b)] )) m;
|
makeBestMoves = map (pair: split pair (a: b: [a (bestMove a b)] ));
|
||||||
in {
|
in {
|
||||||
part1 = totalScore matches;
|
part1 = totalScore matches;
|
||||||
part2 = totalScore (makeBestMoves matches);
|
part2 = totalScore (makeBestMoves matches);
|
||||||
|
2
util.nix
2
util.nix
@ -13,8 +13,6 @@ let
|
|||||||
maxList = lib.foldr lib.max 0;
|
maxList = lib.foldr lib.max 0;
|
||||||
# Sorts a int list. Greatest value first
|
# Sorts a int list. Greatest value first
|
||||||
sortList = lib.sort (x: y: x > y);
|
sortList = lib.sort (x: y: x > y);
|
||||||
# Returns the top cnt items of the list
|
|
||||||
topOfList = cnt: lib.take cnt;
|
|
||||||
# Cuts a list in half and returns the two parts in a list
|
# Cuts a list in half and returns the two parts in a list
|
||||||
cutInHalf = l: [(lib.take (lib.length l / 2) l) (lib.drop (lib.length l / 2) l)];
|
cutInHalf = l: [(lib.take (lib.length l / 2) l) (lib.drop (lib.length l / 2) l)];
|
||||||
# Splits a list into a list of lists with length cnt
|
# Splits a list into a list of lists with length cnt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user