added flag for not writing environment.json

This commit is contained in:
Nicole Dresselhaus 2018-06-22 07:35:47 +02:00
parent 383ba7507f
commit c731a0f131
Signed by: Drezil
GPG Key ID: AC88BB432537313A
3 changed files with 10 additions and 4 deletions

View File

@ -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

Binary file not shown.

Binary file not shown.