From 405df8dbbe724e666ff1d1fa7ba7097428365ccd Mon Sep 17 00:00:00 2001 From: Ummon Date: Tue, 19 Dec 2017 10:12:47 +0100 Subject: [PATCH] Simplify --- AdventOfCode2017/Day19.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AdventOfCode2017/Day19.fs b/AdventOfCode2017/Day19.fs index 281bd64..04d98c8 100644 --- a/AdventOfCode2017/Day19.fs +++ b/AdventOfCode2017/Day19.fs @@ -8,11 +8,11 @@ let followThePath (lines : string[]) : string * int = let c = lines.[i'].[j'] if c = '+' then let nextDir = - [ '-', 0, 1; '|', -1, 0; '-', 0, -1; '|', 1, 0 ] + [ 0, 1; -1, 0; 0, -1; 1, 0 ] |> List.pick ( - fun (c', ndi, ndj) -> + fun (ndi, ndj) -> let ni, nj = i' + ndi, j' + ndj - if (ni, nj) <> (i, j) && (Char.IsLetter lines.[ni].[nj] || lines.[ni].[nj] = c') then Some (ndi, ndj) else None + if (ni, nj) <> (i, j) && (Char.IsWhiteSpace lines.[ni].[nj] |> not) then Some (ndi, ndj) else None ) next (i', j') nextDir str (n + 1) elif Char.IsWhiteSpace c |> not then -- 2.45.2