Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
IOG Engineering committed Feb 3, 2023
1 parent ed31ef9 commit 3412d37
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions 2023-02-03/aoc12/src/AOC.hs
Expand Up @@ -4,12 +4,10 @@ type Position = (Int, Int, Char)

distance :: Position -> Position -> Int
distance (x, y, c) (x', y', c') =
let z = case c of
let zIndex char = case char of
'S' -> 'a'
'E' -> 'z'
_ -> c
z' = case c' of
'S' -> 'a'
'E' -> 'z'
_ -> c'
_ -> char
z = zIndex c
z' = zIndex c'
in abs (x' - x) + abs (y - y') + abs (fromEnum z - fromEnum z')

0 comments on commit 3412d37

Please sign in to comment.