module Util
(
putStrFgc
, putStrLnFgc
, printInvalidAction
, printGraphComplete
, writeToSvgGraph
)
where
import System.Console.ANSI
import System.IO
import PrintableBdd
import Data.HasCacBDD.Visuals
printInvalidAction :: Char -> IO ()
printInvalidAction :: Char -> IO ()
printInvalidAction Char
action = do
Color -> String -> IO ()
putStrFgc Color
Red String
"Invalid action: "
Color -> String -> IO ()
putStrFgc Color
Blue [Char
action]
String -> IO ()
putStrLn String
" is not a valid action in the current context."
printGraphComplete :: IO ()
printGraphComplete :: IO ()
printGraphComplete = do
Color -> String -> IO ()
putStrLnFgc Color
Green String
"\n!!! Graph complete !!!"
String -> IO ()
putStrLn String
"Everybody is an expert (i.e. every agent knows the secrets of all other agents)."
putStrFgc :: Color -> String -> IO ()
putStrFgc :: Color -> String -> IO ()
putStrFgc Color
c String
s = do
[SGR] -> IO ()
setSGR [ConsoleLayer -> ColorIntensity -> Color -> SGR
SetColor ConsoleLayer
Foreground ColorIntensity
Vivid Color
c]
String -> IO ()
putStr String
s
[SGR] -> IO ()
setSGR [SGR
Reset]
putStrLnFgc :: Color -> String -> IO ()
putStrLnFgc :: Color -> String -> IO ()
putStrLnFgc Color
c String
s = do
[SGR] -> IO ()
setSGR [ConsoleLayer -> ColorIntensity -> Color -> SGR
SetColor ConsoleLayer
Foreground ColorIntensity
Vivid Color
c]
String -> IO ()
putStrLn String
s
[SGR] -> IO ()
setSGR [SGR
Reset]
writeToSvgGraph :: String -> Bdd -> IO ()
writeToSvgGraph :: String -> Bdd -> IO ()
writeToSvgGraph String
s Bdd
b = Bdd -> IO String
svgGraph (Bdd -> Bdd
bdd Bdd
b) IO String -> (String -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= String -> String -> IO ()
writeFile String
s