mirror of
https://github.com/mx42/adventofcode.git
synced 2026-01-14 13:59:51 +01:00
WIP 2015 day 9
This commit is contained in:
28
haskellAoC/inputs/2015/09
Normal file
28
haskellAoC/inputs/2015/09
Normal file
@@ -0,0 +1,28 @@
|
||||
Tristram to AlphaCentauri = 34
|
||||
Tristram to Snowdin = 100
|
||||
Tristram to Tambi = 63
|
||||
Tristram to Faerun = 108
|
||||
Tristram to Norrath = 111
|
||||
Tristram to Straylight = 89
|
||||
Tristram to Arbre = 132
|
||||
AlphaCentauri to Snowdin = 4
|
||||
AlphaCentauri to Tambi = 79
|
||||
AlphaCentauri to Faerun = 44
|
||||
AlphaCentauri to Norrath = 147
|
||||
AlphaCentauri to Straylight = 133
|
||||
AlphaCentauri to Arbre = 74
|
||||
Snowdin to Tambi = 105
|
||||
Snowdin to Faerun = 95
|
||||
Snowdin to Norrath = 48
|
||||
Snowdin to Straylight = 88
|
||||
Snowdin to Arbre = 7
|
||||
Tambi to Faerun = 68
|
||||
Tambi to Norrath = 134
|
||||
Tambi to Straylight = 107
|
||||
Tambi to Arbre = 40
|
||||
Faerun to Norrath = 11
|
||||
Faerun to Straylight = 66
|
||||
Faerun to Arbre = 144
|
||||
Norrath to Straylight = 115
|
||||
Norrath to Arbre = 135
|
||||
Straylight to Arbre = 127
|
||||
3
haskellAoC/inputs/2015/09_test
Normal file
3
haskellAoC/inputs/2015/09_test
Normal file
@@ -0,0 +1,3 @@
|
||||
London to Dublin = 464
|
||||
London to Belfast = 518
|
||||
Dublin to Belfast = 141
|
||||
14
haskellAoC/src/Y2015/Day09.hs
Normal file
14
haskellAoC/src/Y2015/Day09.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
module Y2015.Day09 (y15day09) where
|
||||
|
||||
import Data.List.Split
|
||||
|
||||
parseInput :: String -> (String, String, Int)
|
||||
parseInput input = (city1, city2, dist)
|
||||
where (city1:split1:_) = splitOn " to " input
|
||||
(city2:raw_dist:_) = splitOn " = " split1
|
||||
dist = read $ raw_dist
|
||||
|
||||
y15day09 :: [String] -> (String, String)
|
||||
y15day09 input = (part1, part2)
|
||||
where part1 = show $ map parseInput input
|
||||
part2 = "WIP"
|
||||
@@ -8,6 +8,7 @@ import Y2015.Day05
|
||||
import Y2015.Day06
|
||||
import Y2015.Day07
|
||||
import Y2015.Day08
|
||||
import Y2015.Day09
|
||||
|
||||
year2015 :: String -> [String] -> (String, String)
|
||||
year2015 "01" = y15day01
|
||||
@@ -18,3 +19,4 @@ year2015 "05" = y15day05
|
||||
year2015 "06" = y15day06
|
||||
year2015 "07" = y15day07
|
||||
year2015 "08" = y15day08
|
||||
year2015 "09" = y15day09
|
||||
|
||||
Reference in New Issue
Block a user