outputColors :: M.Map Int String -> [Either Int Int] -> String
outputColors numToState result = foldr1 (++) $ map numberToState goodColors
                                 where
                                 goodColors    = rights result
                                 numToColor    = M.fromList $ [(0, "red"),
                                                               (1, "green"),
                                                               (2, "blue"),
                                                               (3, "yellow")]
                                 numberToState num = let nameId  = (num `div` 4) * 4
                                                         colorId = num `mod` 4
                                                     in
                                                     M.findWithDefault undefined nameId numToState
                                                     ++ " "
                                                     ++ M.findWithDefault undefined colorId numToColor
                                                     ++ "\n\r"

-- | Restriction saying that the neighbourgs of a node cannot have the same color
outputColors :: M.Map Int String -> [Either Int Int] -> String
outputColors numToState result = foldr1 (++) $ map numberToState goodColors
                                 where
                                 goodColors    = rights result
                                 numToColor    = M.fromList $ [(0, "red"),
                                                               (1, "green"),
                                                               (2, "blue"),
                                                               (3, "yellow")]
                                 numberToState num = let nameId  = (num `div` 4) * 4
                                                         colorId = num `mod` 4
                                                     in
                                                     M.findWithDefault undefined nameId numToState
                                                     ++ " "
                                                     ++ M.findWithDefault undefined colorId numToColor
                                                     ++ "\n\r"

-- | Restriction saying that the neighbourgs of a node cannot have the same color
outputColors numToState result = foldr1 (++) $ map numberToState goodColors
                                 where
                                 goodColors    = rights result
                                 numToColor    = M.fromList $ [(0, "red"),
                                                               (1, "green"),
                                                               (2, "blue"),
                                                               (3, "yellow")]
                                 numberToState num = let nameId  = (num `div` 4) * 4
                                                         colorId = num `mod` 4
                                                     in
                                                     M.findWithDefault undefined nameId numToState
                                                     ++ " "
                                                     ++ M.findWithDefault undefined colorId numToColor
                                                     ++ "\n\r"

-- | Restriction saying that the neighbourgs of a node cannot have the same color