minor things before tests can start.

This commit is contained in:
Stefan Dresselhaus
2018-06-22 07:11:10 +02:00
parent f478f0ecb6
commit 383ba7507f
3 changed files with 44 additions and 18 deletions

View File

@ -51,6 +51,12 @@ exampleEnvironment addedC es pred tox =
, predatorBehaviour = AttackInterval 10
, numPlants = 50
, logEveryNIterations = 10
, mutationRate = 0.01
, deletionDuplicationRate = 0.05
, geneAddRate = 0.005
, activationNoiseIntensity = 0.01
, staticEnzymeCost = 0.01
, nutrientImpact = 0.01
}
}
@ -252,7 +258,7 @@ main = do
let emptyPlants = replicate (numPlants . settings $ env) emptyPlant
printEverything = verbose opts
enzs <- randomRs (0,length (possibleEnzymes env) - 1) <$> newStdGen
let startPlants = randomGenome 1 enzs (possibleEnzymes env) emptyPlants
let startPlants = randomGenome 2 enzs (possibleEnzymes env) emptyPlants
--writeFile "poison.twopi" $ generateDotFromPoisonTree "poison" 0.5 poisonedTree
LBS.writeFile "environment.json" . encode $ env
when printEverything $ putStr "\ESC[?1049h"
@ -272,7 +278,7 @@ randomGenome num inds enzs (p:ps) = p { genome = genes} : randomGenome num r enz
i' = take num inds
r = drop num inds
enzymes = (enzs!!) <$> i'
genes = (\e -> (e,1,1)) <$> enzymes
genes = (\e -> (e,1,0.5)) <$> enzymes
generatePredators :: Double -> EnzymeTree s (Double,Compound) -> IO [Predator]
@ -308,7 +314,7 @@ printPopulation endemic es ps = do
fitnesses = (\(_,f,_) -> f) <$> ps
meanFitness = sum fitnesses / fromIntegral n
maxFitness = maximum fitnesses
putStr $ padded 50 ("Population: (fitness: mean " ++ padded 5 (show meanFitness) ++ ", max: " ++ padded 5 (show maxFitness) ++ ")")
putStr $ padded 50 (" Population: (fitness: mean " ++ padded 5 (show meanFitness) ++ ", max: " ++ padded 5 (show maxFitness) ++ ")")
forM_ ps $ \(_,f,_) -> putStr (printColor (f/maxFitness) '█')
putStrLn colorOff
forM_ es $ \(e,s) -> do