From 5a3db922efd875cac9b35c568c7f78e04e2e9600 Mon Sep 17 00:00:00 2001 From: Ummon Date: Mon, 11 Dec 2017 08:52:02 +0100 Subject: [PATCH] "further" -> "furthest" --- AdventOfCode2017/Day11.fs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/AdventOfCode2017/Day11.fs b/AdventOfCode2017/Day11.fs index 6adba52..420f9a5 100644 --- a/AdventOfCode2017/Day11.fs +++ b/AdventOfCode2017/Day11.fs @@ -7,18 +7,16 @@ let distanceInHex (moves : string list) = let x, y = abs x, abs y if y >= x then y + (x - y) / 2 else x - let rec next (x, y) further (moves : string list) = - let further' = distance (x, y) |> max further + let rec next (x, y) furthest (moves : string list) = + let furthest' = distance (x, y) |> max furthest match moves with - | "n" :: xs -> next (x, y + 2) further' xs - | "ne" :: xs -> next (x + 1, y + 1) further' xs - | "se" :: xs -> next (x + 1, y - 1) further' xs - | "s" :: xs -> next (x, y - 2) further' xs - | "sw" :: xs -> next (x - 1, y - 1) further' xs - | "nw" :: xs -> next (x - 1, y + 1) further' xs - | _ -> (x, y), further' - - let destination, further = next (0, 0) 0 moves - distance destination, further - + | "n" :: xs -> next (x, y + 2) furthest' xs + | "ne" :: xs -> next (x + 1, y + 1) furthest' xs + | "se" :: xs -> next (x + 1, y - 1) furthest' xs + | "s" :: xs -> next (x, y - 2) furthest' xs + | "sw" :: xs -> next (x - 1, y - 1) furthest' xs + | "nw" :: xs -> next (x - 1, y + 1) furthest' xs + | _ -> (x, y), furthest' + let destination, furthest = next (0, 0) 0 moves + distance destination, furthest \ No newline at end of file -- 2.45.2