creatur 5.2.7 → 5.2.8
raw patch · 28 files changed
+34/−150 lines, 28 files
Files
- creatur.cabal +2/−3
- src/ALife/Creatur.hs +8/−2
- src/ALife/Creatur/Checklist.hs +1/−1
- src/ALife/Creatur/Daemon.hs +1/−1
- src/ALife/Creatur/Database.hs +1/−1
- src/ALife/Creatur/Database/FileSystem.hs +1/−1
- src/ALife/Creatur/Genetics/BRGCBool.hs +1/−1
- src/ALife/Creatur/Genetics/BRGCWord16.hs +1/−1
- src/ALife/Creatur/Genetics/BRGCWord8.hs +1/−1
- src/ALife/Creatur/Genetics/Code.hs +0/−47
- src/ALife/Creatur/Genetics/Diploid.hs +1/−1
- src/ALife/Creatur/Genetics/Recombination.hs +1/−1
- src/ALife/Creatur/Genetics/Reproduction/Sexual.hs +1/−1
- src/ALife/Creatur/Genetics/Reproduction/SimplifiedSexual.hs +1/−1
- src/ALife/Creatur/Logger.hs +1/−1
- src/ALife/Creatur/Task.hs +1/−1
- src/ALife/Creatur/Universe.hs +1/−1
- src/ALife/Creatur/Util.hs +1/−1
- test/ALife/Creatur/CounterQC.hs +1/−1
- test/ALife/Creatur/Database/FileSystemQC.hs +1/−1
- test/ALife/Creatur/Genetics/BRGCBoolQC.hs +1/−1
- test/ALife/Creatur/Genetics/BRGCWord16QC.hs +1/−1
- test/ALife/Creatur/Genetics/BRGCWord8QC.hs +1/−1
- test/ALife/Creatur/Genetics/CodeQC.hs +0/−72
- test/ALife/Creatur/Genetics/DiploidQC.hs +1/−1
- test/ALife/Creatur/Genetics/RecombinationQC.hs +1/−1
- test/ALife/Creatur/UtilQC.hs +1/−1
- test/TestAll.hs +1/−3
creatur.cabal view
@@ -1,5 +1,5 @@ Name: creatur-Version: 5.2.7+Version: 5.2.8 Stability: experimental Synopsis: Framework for artificial life experiments. Description: A software framework for automating experiments@@ -50,7 +50,6 @@ ALife.Creatur.Database, ALife.Creatur.Database.FileSystem, ALife.Creatur.Genetics.Analysis,- ALife.Creatur.Genetics.Code, ALife.Creatur.Genetics.BRGCBool, ALife.Creatur.Genetics.BRGCWord8, ALife.Creatur.Genetics.BRGCWord16,@@ -62,6 +61,7 @@ ALife.Creatur.Universe, ALife.Creatur.Task, ALife.Creatur.Util+ Other-modules: Paths_creatur Build-Depends: array ==0.4.* || ==0.5.*, base ==4.*,@@ -110,7 +110,6 @@ Other-modules: ALife.Creatur.UtilQC ALife.Creatur.CounterQC ALife.Creatur.Database.FileSystemQC- ALife.Creatur.Genetics.CodeQC ALife.Creatur.Genetics.DiploidQC, ALife.Creatur.Genetics.BRGCBoolQC ALife.Creatur.Genetics.BRGCWord8QC
src/ALife/Creatur.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental@@ -16,10 +16,13 @@ ( Agent(..), AgentId,- Time+ Time,+ programVersion ) where import ALife.Creatur.Database (Record, key)+import Data.Version (showVersion)+import Paths_creatur (version) -- | The internal clock used by Créatúr is a simple counter. type Time = Int@@ -35,3 +38,6 @@ agentId = key -- | Returns True if the agent is alive, false otherwise. isAlive :: a -> Bool++programVersion :: String+programVersion = "creatur-" ++ showVersion version
src/ALife/Creatur/Checklist.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Checklist--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Daemon.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Daemon--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Database.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Database--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Database/FileSystem.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Database.FileSystem--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/BRGCBool.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCBool--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/BRGCWord16.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCWord16--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/BRGCWord8.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCWord8--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
− src/ALife/Creatur/Genetics/Code.hs
@@ -1,47 +0,0 @@---------------------------------------------------------------------------- |--- Module : ALife.Creatur.Genetics.Code--- Copyright : (c) Amy de Buitléir 2011-2013--- License : BSD-style--- Maintainer : amy@nualeargais.ie--- Stability : experimental--- Portability : portable------ Lookup table for encoding genes.-----------------------------------------------------------------------------module ALife.Creatur.Genetics.Code- (- -- * Coding schemes- Code(..),- -- * Encoding and decoding- encode,- encodeNext,- decode,- decodeNext- ) where--import ALife.Creatur.Util (reverseLookup)---- | An encoding scheme.-data Code a b = Code { cSize :: Int, cTable :: [(a,[b])] } deriving Show---- | Encodes a value as a sequence of letters in the code alphabet.-encode :: Eq a => Code a b -> a -> Maybe [b]-encode = flip lookup . cTable---- | Encodes a value and append it to the sequence provided. If the--- value cannot be encoded, the sequence is returned unmodified.-encodeNext :: Eq a => Code a b -> a -> [b] -> [b]-encodeNext c a bs = maybe bs (bs ++) (encode c a)---- | Returns the value corresponding to a sequence of letters in the--- code alphabet.-decode :: Eq b => Code a b -> [b] -> Maybe a-decode = flip reverseLookup . cTable---- | Decodes a value from a sequence, and returns the value and the--- unused portion of the sequence.-decodeNext :: Eq b => Code a b -> [b] -> Maybe (a, [b])-decodeNext c bs = decode c bs1 >>= \g -> Just (g, bs2)- where (bs1, bs2) = splitAt (cSize c) bs
src/ALife/Creatur/Genetics/Diploid.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.Diploid--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/Recombination.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.Recombination--- Copyright : (c) Amy de Buitléir 2011-2013+-- Copyright : (c) Amy de Buitléir 2011-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/Reproduction/Sexual.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.Reproduction.Sexual--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Genetics/Reproduction/SimplifiedSexual.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.Reproduction.SimplifiedSexual--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Logger.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Logger--- Copyright : (c) Amy de Buitléir 2011-2013+-- Copyright : (c) Amy de Buitléir 2011-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Task.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Task--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Universe.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Universe--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
src/ALife/Creatur/Util.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Util--- Copyright : (c) Amy de Buitléir 2011-2013+-- Copyright : (c) Amy de Buitléir 2011-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/CounterQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.CounterQC--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/Database/FileSystemQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Database.FileSystemQC--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/Genetics/BRGCBoolQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCBoolQC--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/Genetics/BRGCWord16QC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCWord16QC--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/Genetics/BRGCWord8QC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.BRGCWord8QC--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
− test/ALife/Creatur/Genetics/CodeQC.hs
@@ -1,72 +0,0 @@---------------------------------------------------------------------------- |--- Module : ALife.Creatur.Genetics.CodeQC--- Copyright : (c) Amy de Buitléir 2012-2013--- License : BSD-style--- Maintainer : amy@nualeargais.ie--- Stability : experimental--- Portability : portable------ QuickCheck tests.-----------------------------------------------------------------------------module ALife.Creatur.Genetics.CodeQC- (- test- ) where--import ALife.Creatur.Genetics.Code-import Data.List (nub)-import Test.Framework as TF (Test, testGroup)-import Test.Framework.Providers.QuickCheck2 (testProperty)-import Test.QuickCheck (Arbitrary, Gen, Property, arbitrary, property, - sized, vectorOf)---- Guaranteed not to have multiple values for the same code (but might--- have multiple codes for the same value). Compare with TestCode2.-data TestCode = TestCode (Code Char Bool) deriving Show--sizedArbTestCode :: Int -> Gen TestCode-sizedArbTestCode n = do- cs <- vectorOf n arbitrary- xs <- vectorOf n arbitrary- return $ TestCode $ Code n $ zip cs (nub xs)--instance Arbitrary TestCode where- arbitrary = sized sizedArbTestCode--prop_encoding_round_trippable :: TestCode -> Char -> Property-prop_encoding_round_trippable (TestCode g) c =- property $ maybe Nothing (decode g) (encode g c) == c'- where c' = if c `elem` cs then Just c else Nothing- cs = map fst $ cTable g---- Guaranteed not to have multiple values for the same code, or multiple--- codes for the same value. Compare with TestCode.-data TestCode2 = TestCode2 (Code Char Bool) deriving Show--sizedArbTestCode2 :: Int -> Gen TestCode2-sizedArbTestCode2 n = do- cs <- vectorOf n arbitrary- xs <- vectorOf n arbitrary- return $ TestCode2 $ Code n $ zip (nub cs) (nub xs)--instance Arbitrary TestCode2 where- arbitrary = sized sizedArbTestCode2--prop_decoding_round_trippable :: TestCode2 -> [Bool] -> Property-prop_decoding_round_trippable (TestCode2 g) x =- property $ maybe Nothing (encode g) (decode g x) == x'- where x' = if x `elem` xs then Just x else Nothing- xs = map snd $ cTable g--test :: Test-test = testGroup "QuickCheck ALife.Creatur.Genetics.CodeQC"- [- testProperty "prop_encoding_round_trippable"- prop_encoding_round_trippable,- testProperty "prop_decoding_round_trippable"- prop_decoding_round_trippable- ]--
test/ALife/Creatur/Genetics/DiploidQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.DiploidQC--- Copyright : (c) Amy de Buitléir 2013+-- Copyright : (c) Amy de Buitléir 2013-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/Genetics/RecombinationQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.Genetics.RecombinationQC--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/ALife/Creatur/UtilQC.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : ALife.Creatur.UtilQC--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental
test/TestAll.hs view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- | -- Module : Main--- Copyright : (c) Amy de Buitléir 2012-2013+-- Copyright : (c) Amy de Buitléir 2012-2014 -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental@@ -17,7 +17,6 @@ import ALife.Creatur.UniverseQC (test) import ALife.Creatur.Database.FileSystemQC (test) import ALife.Creatur.UtilQC (test)-import ALife.Creatur.Genetics.CodeQC (test) import ALife.Creatur.Genetics.DiploidQC (test) import ALife.Creatur.Genetics.RecombinationQC (test) import ALife.Creatur.Genetics.BRGCBoolQC (test)@@ -34,7 +33,6 @@ ALife.Creatur.UniverseQC.test, ALife.Creatur.Database.FileSystemQC.test, ALife.Creatur.UtilQC.test,- ALife.Creatur.Genetics.CodeQC.test, ALife.Creatur.Genetics.DiploidQC.test, ALife.Creatur.Genetics.RecombinationQC.test, ALife.Creatur.Genetics.BRGCBoolQC.test,