From e77c343ebe1d77ee8f61939091c44a47c3d9e6bc Mon Sep 17 00:00:00 2001 From: Ummon Date: Mon, 11 Dec 2017 09:15:31 +0100 Subject: [PATCH] Cleaning... --- AdventOfCode2017/Day11.fs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/AdventOfCode2017/Day11.fs b/AdventOfCode2017/Day11.fs index e2ccf32..400e0eb 100644 --- a/AdventOfCode2017/Day11.fs +++ b/AdventOfCode2017/Day11.fs @@ -8,7 +8,14 @@ let distanceInHex (moves : string) = let destination, furthest = moves.Split ',' |> Seq.fold ( fun ((x, y), furthest) m -> - let pos = match m with "n" -> (x, y + 2) | "ne" -> (x + 1, y + 1) | "se" -> (x + 1, y - 1) | "s" -> (x, y - 2) | "sw" -> (x - 1, y - 1) | _ -> (x - 1, y + 1) - pos, distance pos |> max furthest + let next = + match m with + | "n" -> (x , y + 2) + | "ne" -> (x + 1, y + 1) + | "se" -> (x + 1, y - 1) + | "s" -> (x , y - 2) + | "sw" -> (x - 1, y - 1) + | _ -> (x - 1, y + 1) + next, distance next |> max furthest ) ((0, 0), 0) distance destination, furthest \ No newline at end of file -- 2.45.2