From 440dd38f24d1df150fb5b4c7965bb6e792c929fe Mon Sep 17 00:00:00 2001 From: Ray Hogenson Date: Sat, 7 Sep 2019 16:36:01 -0700 Subject: Write a little guy This program is in a weird state right now, but I'm checking it in to git so that I can back it up, since I want to reinstall again. --- Main.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Main.hs (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs new file mode 100644 index 0000000..20413f7 --- /dev/null +++ b/Main.hs @@ -0,0 +1,20 @@ +module Main where + +import qualified BrainFuck +import System.Environment (getArgs) +import qualified Evolve +import qualified Control.Concurrent.Chan as Chan +import Control.Concurrent (forkIO) +import Data.List (intercalate) + +type BF = [BrainFuck.BF] + +main :: IO () +main = do a <- getArgs + s <- readFile (head a) + let bf = BrainFuck.strToBF s + c <- Chan.newChan + _ <- forkIO $ Evolve.evolve c bf + generations <- Chan.getChanContents c + mapM_ display generations + where display e = putStrLn $ BrainFuck.runBF e ++ "\ncode: (" ++ intercalate "" (map show e) ++ ")" -- cgit v1.3.1