Commits

Lucian Brănescu-Mihăilă committed 92a28d1

Roads

  • Participants
  • Parent commits b1c04ab

Comments (0)

Files changed (2)

+#!/usr/bin/runkaskell
+
+data Node = Node Road (Maybe Road)
+data Road = Road Int Node
+
+data Section = Section { getA :: Int, getB :: Int, getC :: Int} deriving (Show)
+type RoadSystem = [Section]
+
+heathrowToLondon :: RoadSystem
+heathrowToLondon = [Section 50 10 30,
+                    Section 5 90 20,
+                    Section 40 2 25,
+                    Section 10 8 0]
+
+data Label = A | B | C deriving (Show)
+type Path = [(Label, Int)]
+
+optimalPath :: RoadSystem -> Path
-#!/usr/bin/runhaskell
-
 solveRPN :: String -> Float
 solveRPN = head . foldl compute [] . words
     where compute (x:y:ys) "*" = (x * y):ys