_SFvb      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aSafe bcdefghijklmncijklmn bcdefghijklmn(c) Amy de Buitlir 2011-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneFrom 1http://www.haskell.org/haskellwiki/Random_shuffle xs n x returns a copy of xs in which the n4th element (if it exists) has been replaced with x. xs n x returns a copy of xs in which the n%th element has been replaced with x. Causes an exception if xs has fewer than n+1 elements. Compare with . Assuming xs> is a sequence containing the elements of a square matrix,  n xs/ returns the elements of the submatrix of size nxn(, centred within the original matrix xs.Example: Suppose we have a 5x5. matrix and we want to extract the central 3x3! submatrix, as illustrated below. da b c d e f g h i j g h i k l m n o ---> l m n p q r s t q r s u v w x y8We can represent the elements of the original matrix as  ['a'..'y']*. The elements of the submatrix are -['g', 'h', 'i', 'l', 'm', 'n', 'q', 'r', 's'], or equivalently,  "ghilmnqrs". And that is what  3 ['a'..'y'] returns. Assuming xs8 is a sequence containing the elements of a matrix with k columns,  (a,b) (c, d) k xs/ returns the elements of the submatrix from (a,b) in the upper left corner to (c,d)A in the lower right corner). Note: Matrix indices begin at (0,0).Example: Suppose we have a 4x6Z matrix and we want to extract the submatrix from (1,2) to (2,4), as illustrated below. Oa b c d e f g h i j k l ---> i j k m n o p q r o p q s t u v w x8We can represent the elements of the original matrix as  ['a'..'x']*. The elements of the submatrix are ['i', 'j', 'k', 'o', 'p', 'q'], or equivalently, "ijkopq". And that is what  (1,2) (2,4) 6 ['a'..'x'] returns. nE returns the greatest integer not greater than the square root of n. n mD returns the greatest integer not greater than the log base n of m. n returns True if nQ is a perfect square (i.e., if there exists an _integer_ m such that m*m = n)n  m returns True if nM is a power of m (i.e., if there exists an _integer_ k such that m^k = n) The  ' function takes a default value and an o value. If the o is pT, it returns the default value; otherwise, it returns the value contained in the q. Takes a list of o s and returns a list of all the q values. vLike modify, but the function that maps the old state to the new state operates in the inner monad. For example, s <- get s' = lift $ f s put s'can be replaced with  modifyLift fInvoke a function in the inner monad, and pass the state as a parameter. Similar to modifyLift, but the function being invoked doesn't have a return value, so the state is not modified. For example, s <- get s' = lift $ f scan be replaced with  getLift f&Convert a list of bits to a string of 0s and 1s.Show  non-negative r numbers in binary.s    s (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneBCreates a counter that will store its value in the specified file.tuvwxyz{| tuvwxyz{|(c) Amy de Buitlir 2011-2016 BSD-styleamy@nualeargais.ie experimentalportableSafe msg& formats and writes a new log message.(c) Amy de Buitlir 2011-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneA rotating logger. f- creates a logger that will write to file f. }~ }~ (c) Amy de Buitlir 2011-2016 BSD-styleamy@nualeargais.ie experimentalportableNone#A rotating logger.$$ d prefix n2 creates a logger that will write to directory d2. The log "rotates" (starts a new log file) every n4 records. Log files follow the naming convention prefix.k, where kj is the number of the last log record contained in the file. If logging has already been set up in  directoryY, then logging will continue where it left off; appending to the most recent log file.#$%#$#$ #$%(c) Amy de Buitlir 2011-2016 BSD-styleamy@nualeargais.ie experimentalportableNone (qCuts two lists at the specified locations, swaps the ends, and splices them. The resulting lists will be: 6 a[0..n-1] ++ b[m..] b[0..m-1] ++ a[n..]  Here are some examples.   Expression Result (6 2 5 ("abcdef", "ABCDEF") ("abF","ABCDEcdef") (5 3 1 ("abcd", "ABCDEFG") ("abcBCDEFG","Ad") (4 4 4 ("abcdef", "ABCDEF") ("abcdEF","ABCDef") i If n <= 0 or m <= 0, the corresponding input list will be completely transferred to the other.   Expression Result (6 0 4 ("abcdef", "ABCDEF") ("EF","ABCDabcdef") (6 (-2) 4 ("abcd", "ABCDEFGH") ("EFGH","ABCDabcd") (4 5 0 ("abcdef", "ABCDEF") ("abcdeABCDEF","f") v If n or m are greater than or equal to length of the corresponding list, that list will not be transferred.   Expression Result (6 10 0 ("abcdef", "ABCDEF") ("abcdefABCDEF","") (. 0 0 ("", "ABCDEF") ("ABCDEF","") )Same as (8, except that the two locations are chosen at random.*gCuts two lists at the specified location, swaps the ends, and splices them. This is a variation of ( where n == m.+Same as *3, except that the location is chosen at random.,%Mutates a random element in the list.-/Mutates a random element in one list in a pair..5Performs an operation with the specified probability./^Performs an operation a random number of times. The probability of repeating the operation n times is p^n.NRandomly select a boolean, but weighted to return True with probability p.PChoose an element at random from a list and return the element and its index ()*+,-./01 ()*+,-./01 *(,-10+)/. ()*+,-./01(c) Amy de Buitlir 2013-2016 BSD-styleamy@nualeargais.ie experimentalportableSafe 569:;DQR2A diploid agent has two complete sets of genetic instructions. Instances of this class can be thought of as paired genes or paired instructions for building an agent. When two instructions in a pair differ,  dominance2 relationships determine how the genes will be  expressed/ in the agent. Minimal complete definition: 3.3$Given two possible forms of a gene, 3a takes into account any dominance relationship, and returns a gene representing the result.A3Products: encode multiple arguments to constructorsB(Sums: encode choice between constructorsC*Meta-information (constructor names, etc.)D8Constants, additional parameters and recursion of kind *E-Unit: used for constructors without arguments23456789:;<=>?@ABCDE2342334233456789:;<=>?@ABCDE(c) Amy de Buitlir 2013-2016 BSD-styleamy@nualeargais.ie experimentalportableNone 569:;DQRTH(A class representing anything which is represented in, and determined by, an agent's genome. This might include traits, parameters, "organs" (components of agents), or even entire agents. Instances of this class can be thought of as genes, i.e., instructions for building an agent.IWrites a gene to a sequence.J"Reads the next gene in a sequence.SReturn the entire genome.T4Return the portion of the genome that has been read.U5Write a Word8 value to the genome without encoding itV6Read a Word8 value from the genome without decoding itW2Write a raw sequence of Word8 values to the genomeX3Read a raw sequence of Word8 values from the genome]Return the entire genome.^4Return the portion of the genome that has been read._Read the next pair of genes from twin sequences of genetic information, and return the resulting gene (after taking into account any dominance relationship) and the remaining (unread) portion of the two nucleotide strands.n3Products: encode multiple arguments to constructorso(Sums: encode choice between constructorsp*Meta-information (constructor names, etc.)q8Constants, additional parameters and recursion of kind *r-Unit: used for constructors without argumentsCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrFGHJIKLMNOPQRSTUVWXYZ[\]^_`HIIJJKNMOPLQRSTGF[\_`]^YZUVWX<FGHIIJJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr (c) Amy de Buitlir 2014-2016 BSD-styleamy@nualeargais.ie experimentalportableNone 569:;DQRu(A class representing anything which is represented in, and determined by, an agent's genome. This might include traits, parameters, "organs" (components of agents), or even entire agents. Instances of this class can be thought of as genes, i.e., instructions for building an agent.vWrites a gene to a sequence.w"Reads the next gene in a sequence.Return the entire genome.4Return the portion of the genome that has been read.6Write a Word16 value to the genome without encoding it7Read a Word16 value from the genome without decoding it3Write a raw sequence of Word16 values to the genome4Read a raw sequence of Word16 values from the genomeReturn the entire genome.4Return the portion of the genome that has been read.Read the next pair of genes from twin sequences of genetic information, and return the resulting gene (after taking into account any dominance relationship) and the remaining (unread) portion of the two nucleotide strands.3Products: encode multiple arguments to constructors(Sums: encode choice between constructors*Meta-information (constructor names, etc.)8Constants, additional parameters and recursion of kind *-Unit: used for constructors without arguments,stuvwxyz{|}~stuwvxyz{|}~uvvwwxy|{}~zts&stuvvwwxyz{|}~ (c) Amy de Buitlir 2013-2016 BSD-styleamy@nualeargais.ie experimentalportableNone 569:;DQR (A class representing anything which is represented in, and determined by, an agent's genome. This might include traits, parameters, "organs" (components of agents), or even entire agents. Instances of this class can be thought of as genes, i.e., instructions for building an agent.Writes a gene to a sequence."Reads the next gene in a sequence.Return the entire genome.4Return the portion of the genome that has been read.Return the entire genome.4Return the portion of the genome that has been read.Read the next pair of genes from twin sequences of genetic information, and return the resulting gene (after taking into account any dominance relationship) and the remaining (unread) portion of the two nucleotide strands.3Products: encode multiple arguments to constructors(Sums: encode choice between constructors*Meta-information (constructor names, etc.)8Constants, additional parameters and recursion of kind *-Unit: used for constructors without arguments+% (c) Amy de Buitlir 2013-2016 BSD-styleamy@nualeargais.ie experimentalportableSafe 569:;DQRAnalyses a genetic sequence.3Products: encode multiple arguments to constructors(Sums: encode choice between constructors*Meta-information (constructor names, etc.)8Constants, additional parameters and recursion of kind *-Unit: used for constructors without arguments (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:<DR6A database offering storage and retrieval for records..Get a list of all active keys in the database.4Return the number of records stored in the database.~Get a list of all archived keys in the database. If the database does not implement archiving, it may return an empty list.(Read an active record from the database.*Read an archived record from the database.jWrite a record to the database. If an agent with the same name already exists, it will be overwritten.hRemove a record from the database. The database may archive records rather than simply deleting them.  (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:DRsA simple database where each record is stored in a separate file, and the name of the file is the record's key. d0 (re)creates the FSDatabase in the directory d.Read a record from a file.Write a record to a file. (c) Amy de Buitlir 2014-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:DRTsA simple database where each record is stored in a separate file, and the name of the file is the record's key. mkFSDatabase d0 (re)creates the FSDatabase in the directory d. (c) Amy de Buitlir 2014-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:DR(c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:DR%The work to be performed by a daemon.!Operations to perform on startup."Operations to perform on shutdown.-Operations to perform if an exception occurs./Operations to perform repeatedly while running.7Number of microseconds to sleep between invocations of .RCreates a simple daemon to run a job. The daemon will run under the login name. daemon state! creates a daemon, which invokes daemon. *Note:* If user (in ) is Just ""2, the daemon will run under the login name. If usera is Nothing, the daemon will run under the name of the executable file containing the daemon.  (c) Amy de Buitlir 2013-2016 BSD-styleamy@nualeargais.ie experimentalportableNone9;BCreates a counter that will store its value in the specified file.   (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone9:;DR]An artificial life species. All species used in Cratr must be an instance of this class. Returns the agent ID. 4Returns True if the agent is alive, false otherwise. %A unique ID associated with an agent. 7The internal clock used by Cratr is a simple counter.                    (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneA clock representing the time in a Cratr universe. It is used to schedule events and ensure that each agent gets its fair share of the CPU. This clock is entirely separate from the system clock. It advances only when  is called. This allows Cratr to run without being affected by other processes which might be using the CPU at the same time.%The current time, measured in "ticks"%Advance the clock to the next "tick".(c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone9;BCreates a counter that will store its value in the specified file.(c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone-Assign a unique ID using the supplied prefix. (c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneDRyA species that reproduces, transmitting genetic information to its offspring. Minimal complete definition: all except mate. |A sequence of hereditary information for an agent. The type signature for the agent's genome is (Strand a, Strand a).! From the twoC strands of the genetic information from this agent, creates a singlex strand that will contribute to the child's genome. (This is analogous to creating either a single sperm or ova.)"LBuilds an agent based on the genome provided, if it is possible to do so.## (parent1, parent2) name& uses the genetic information from parent1 and parent2) to produce a child with the agent ID name. The default implementation: Calls !J to produce a single strand of genetic information from each parent.7Pairs the two strands to create a genome for the child.Calls "$ construct a child with this genome. !"# "!# !"# !"#(c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNoneDR$yA species that reproduces, transmitting genetic information to its offspring. Minimal complete definition: all except mate.%2A sequence of hereditary information for an agent.&mRecombines the genetic information from two parents, creating genetic information for potential offspring.,Typically this involves the following steps: hRecombine the two strands of genetic information (one from each parent) to obtain two new strands.1Discard one strand, and return the remaining one.'LBuilds an agent based on the genome provided, if it is possible to do so.(( (parent1, parent2) name& uses the genetic information from parent1 and parent2) to produce a child with the agent ID name. The default implementation: Calls &" to create a genome for the child.Calls '' to construct a child with this genome.$%&'($%'(&$%&'($%&'((c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone 9:;DRT+A program involving multiple agents. The input parameter is a list of agents. The program must return a list of agents that have been *modified*. The order of the output list is not important.,A program involving one agent. The input parameter is the agent. The program must return the agent (which may have been modified).-%A habitat containing artificial life.>-The current "time" (counter) in this universe?8Increment the current "time" (counter) in this universe.@2Write a message to the log file for this universe.A'Generate a unique name for a new agent.B-Returns the list of agents in the population.C1Returns the list of (dead) agents in the archive.D+Returns the current size of the population.EzFetches the agent with the specified ID from the population. Note: Changes made to this agent will not "take" until H is called.F9Fetches the agent with the specified ID from the archive.G>Fetches the agents with the specified IDs from the population.HIf the agent is alive, adds it to the population (replacing the the previous copy of that agent, if any). If the agent is dead, places it in the archive.J!Run a program involving one agentLRReturns the current lineup of (living) agents in the universe. Note: Check for N and call O, if needed before invoking this function.MKReturns true if no agents have yet their turn at the CPU for this round.N{Returns true if the lineup is empty or if all of the agents in the lineup have had their turn at the CPU for this round.OZCreates a fresh lineup containing all of the agents in the population, in random order.P\Mark the current agent done. If it is still alive, it will move to the end of the lineup.?)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST*)*+,-.3/021645789:;<=>?@ABCDEFGHIJKLMNOPQR*-./450671892:;3<=*)QR>?@BCDEFGHA,J+KILMNOP#)*+,-./450671892:;3<=>?@ABCDEFGHIJKLMNOPQRST(c) Amy de Buitlir 2012-2016 BSD-styleamy@nualeargais.ie experimentalportableNone:DR]ZCan be used as a startupHandler, shutdownHandler, startRoundProgram, or endRoundProgram YZ[\]^_`a +,JKYZ[\]^_`a ,+JK^_YZ[]\`a YZ[\]^_`a !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ a b c d e f g h i j k l m n o v w x y z { | } ~  a b c d e f g h i j k l m n o v w x y z { | } ~        67      !"#$%&'()*+,-./01231241251678-9:;<=>?9@A=>B>@CADEFG=>HIJBKLMNOPQRSTUVWXYZ[\]^_`abcdefg U V W h g U V W i j k l g m n o p  @ q r s t = > u vwxyz{|}~%creatur-5.9.18-541YQ6oGugIJxDAG7VJtibALife.Creatur.UtilALife.Creatur.PersistentALife.Creatur.Logger!ALife.Creatur.Logger.SimpleLogger)ALife.Creatur.Logger.SimpleRotatingLogger$ALife.Creatur.Genetics.RecombinationALife.Creatur.Genetics.Diploid ALife.Creatur.Genetics.BRGCWord8!ALife.Creatur.Genetics.BRGCWord16ALife.Creatur.Genetics.BRGCBoolALife.Creatur.Genetics.AnalysisALife.Creatur.Database!ALife.Creatur.Database.FileSystem/ALife.Creatur.Database.CachedFileSystemInternalALife.Creatur.DaemonALife.Creatur.Checklist ALife.CreaturALife.Creatur.ClockALife.Creatur.CounterALife.Creatur.Namer*ALife.Creatur.Genetics.Reproduction.Sexual4ALife.Creatur.Genetics.Reproduction.SimplifiedSexualALife.Creatur.UniverseALife.Creatur.Task Paths_creatur'ALife.Creatur.Database.CachedFileSystemshufflesafeReplaceElementreplaceElement cropSquarecropRectisqrtilogBase perfectSquare isPowerOf reverseLookupstateMap fromEither catEithers modifyLiftgetLiftrotate boolsToBitsshowBin Persistent mkPersistentgetPSputPSmodifyPSrunPS$fShowPersistent$fReadPersistent$fEqPersistentLogger writeToLog timestamp SimpleLoggermkSimpleLogger$fLoggerSimpleLogger$fShowSimpleLogger$fEqSimpleLoggerSimpleRotatingLoggermkSimpleRotatingLogger$fLoggerSimpleRotatingLogger$fShowSimpleRotatingLogger$fEqSimpleRotatingLogger cutAndSplicerandomCutAndSplice crossoverrandomCrossover mutateListmutatePairedListswithProbabilityrepeatWithProbabilityrandomOneOfPairrandomOneOfListDiploidexpress expressMaybe $fDiploid(,)$fDiploidMaybe $fDiploid[]$fDiploidDouble$fDiploidWord64$fDiploidWord32$fDiploidWord16$fDiploidWord8 $fDiploidWord $fDiploidInt $fDiploidChar $fDiploidBool $fGDiploidK1 $fGDiploidM1 $fGDiploid:+: $fGDiploid:*: $fGDiploidU1 DiploidReaderDiploidSequenceGeneticputgetgetWithDefaultReaderWriterSequencewrite runWriterread runReadercopyconsumed putRawWord8 getRawWord8 putRawWord8s getRawWord8s putAndReport getAndReportreadAndExpressrunDiploidReadercopy2 consumed2 getAndExpressgetAndExpressWithDefault$fGeneticEither $fGenetic(,)$fGeneticMaybe $fGenetic[]$fGeneticDouble$fGeneticInteger $fGeneticInt$fGeneticWord64$fGeneticWord32$fGeneticWord16$fGeneticWord8 $fGeneticChar $fGeneticBool $fGGeneticK1 $fGGeneticM1 $fGGenetic:+: $fGGenetic:*: $fGGeneticU1 getWithName putRawWord16 getRawWord16 putRawWord16s getRawWord16s Analysableanalyse$fAnalysableEither$fAnalysable(,)$fAnalysableMaybe$fAnalysable[]$fAnalysableWord16$fAnalysableWord8$fAnalysableChar$fAnalysableBool$fGAnalysableK1$fGAnalysableM1$fGAnalysable:+:$fGAnalysable:*:$fGAnalysableU1DatabaseDBRecordkeys numRecords archivedKeyslookuplookupInArchivestoredelete SizedRecordsizeRecordkey FSDatabase mkFSDatabase$fDatabaseFSDatabase$fShowFSDatabase$fEqFSDatabaseCachedFSDatabasedatabasecache maxCacheSizewithFSDB fromCache addToCachedeleteByKeyFromCachedeleteFromCache trimCachetrimlistSizemkCachedFSDatabase$fDatabaseCachedFSDatabase$fShowCachedFSDatabase$fEqCachedFSDatabase CreaturDaemondaemonjobJob onStartup onShutdown onExceptiontask sleepTime simpleDaemonlaunchlaunchInteractiverequestShutdownPersistentChecklist CheckliststatusmarkDone notStarteddonesetItemsmkPersistentChecklist$fChecklistPersistentAgentagentIdisAliveAgentIdTimeprogramVersionClock currentTimeincTimePersistentCounterCountercurrent incrementmkPersistentCounter$fClockPersistent$fCounterPersistent SimpleNamerNamergenName mkSimpleNamer$fNamerSimpleNamer$fShowSimpleNamer$fEqSimpleNamer ReproductiveStrand produceGametebuild makeOffspring recombineCachedUniverseSimpleUniverse AgentsProgram AgentProgramUniverseAgentDBclocksetClocklogger setLoggeragentDB setAgentDB agentNamersetNamer checklist setChecklistagentIdsarchivedAgentIdspopSizegetAgentgetAgentFromArchive getAgentsisNew withAgent withAgentslineup startOfRound endOfRound refreshLineupmkSimpleUniversemkCachedUniverse$fUniverseCachedUniverse$fUniverseSimpleUniverse$fShowSimpleUniverse$fEqSimpleUniverse$fShowCachedUniverse$fEqCachedUniverse simpleJobstartupHandlershutdownHandlerexceptionHandler doNothingrunNoninteractingAgentsrunInteractingAgents checkPopSizecatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNamebase Data.EitherEitherLeftRightGHC.RealIntegral safeSlice psInitialisedpsValuepsDefaultValue psFilename initIfNeeded initialise readValue initialised logFilenamewrite' directory expFilenamemaxRecordsPerFile recordCountlogCountdebug readState saveStatebumpRecordCountrotateLogIfNeeded rotateLogweightedRandomBooleanrandomListSelectionGDiploidgexpressLRLRGGeneticgputgget convertLR word8ToBool grayWord16 grayWord32 grayWord64integralToBytesbytesToIntegralintegralToByteArraybyteArrayToIntegralfinalisegetListreportWreplaceReportWreportRreplaceReportR expressEither word16ToBoolputRawBoolArraygetRawBoolArray intToBools boolsToInt GAnalysableganalyse readRecord3 writeRecord3mainDir archiveDirkeysInlookupIn writeRecord2isRecordFileName termReceiveddefaultToLoginName daemonMaindaemonMainLoopwrapStatusprefixcounter withCountercuClockcuLoggercuDBcuNamer cuChecklistsuClocksuLoggersuDBsuNamer suChecklist withClock withLogger withAgentDB withNamer withChecklistarchiveshuffledAgentIdsreportExceptionatStartOfRound atEndOfRound