From 4be929622f8bb079da57e8b75422bb650b05f040 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 7 Dec 2021 10:10:13 -0600 Subject: [PATCH] Move things around --- 2021/seven.nim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/2021/seven.nim b/2021/seven.nim index 2763ff5..cb11319 100644 --- a/2021/seven.nim +++ b/2021/seven.nim @@ -1,9 +1,6 @@ import std/[strutils, sequtils, tables, strformat] import ./common -proc f(n: int): int = toSeq(0..abs(n)).foldl(a + b, 0) - - proc crabsDistance(input: string): int = result = int.high() var max_try = 0 @@ -14,6 +11,8 @@ proc crabsDistance(input: string): int = let fuel = dists.foldl(a + abs(b - t), 0) if fuel < result: result = fuel +proc f(n: int): int = toSeq(0..abs(n)).foldl(a + b, 0) + proc crabsBigDistance(input: string): int = result = int.high() var max_try = 0 @@ -27,7 +26,6 @@ proc crabsBigDistance(input: string): int = let input = 7.loadInputText() time("day 7 part 1"): echo input.crabsDistance() time("day 7 part 2"): echo input.crabsBigDistance() -# time("day 7 part 2"): echo "?" when not defined(release): let testInput = "16,1,2,0,4,2,7,1,2,14"