diff --git a/app/Main.hs b/app/Main.hs index 1c4f962..1a2c54e 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -202,9 +202,10 @@ loop loopAmount ps env opts = loop' loopAmount 0 ps env loop' loopAmount (curLoop+1) newPlants s data CLIOptions = CLIOptions - { environment :: Maybe FilePath - , logfile :: FilePath - , verbose :: Bool + { environment :: Maybe FilePath + , logfile :: FilePath + , verbose :: Bool + , dumpEnvironment :: Bool } cliOptParser :: Parser CLIOptions @@ -228,6 +229,11 @@ cliOptParser = CLIOptions <> short 'v' <> help "show 'gui' during process" ) + <*> switch + (long "write-environment" + <> short 'w' + <> help "write environment used to $PWD/environment.json" + ) cliopts = info (cliOptParser <**> helper) (fullDesc @@ -260,7 +266,7 @@ main = do enzs <- randomRs (0,length (possibleEnzymes env) - 1) <$> newStdGen let startPlants = randomGenome 2 enzs (possibleEnzymes env) emptyPlants --writeFile "poison.twopi" $ generateDotFromPoisonTree "poison" 0.5 poisonedTree - LBS.writeFile "environment.json" . encode $ env + when (dumpEnvironment opts) $ LBS.writeFile "environment.json" . encode $ env when printEverything $ putStr "\ESC[?1049h" loghandle <- openFile (logfile opts) WriteMode putStrLn $ "logging to: " ++ logfile opts diff --git a/simulation_am.ods b/simulation_am.ods index b8e4b2e..965874b 100644 Binary files a/simulation_am.ods and b/simulation_am.ods differ diff --git a/simulation_no_am.ods b/simulation_no_am.ods index e619548..ce04890 100644 Binary files a/simulation_no_am.ods and b/simulation_no_am.ods differ