x      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r stuvwxyz{|}~portable experimentalamy@nualeargais.ieNoneA rotating logger. write msg' formats and writes a new log message.  d prefix n% creates a logger that will write to  directory d . The log "rotates" (starts a new log file) every n 3 records. Log files follow the naming convention prefix.k, where k J is the number of the last log record contained in the file. If logging  has already been set up in  directory#, then logging will continue where 7 it left off; appending to the most recent log file.  portable experimentalamy@nualeargais.ie Safe-InferredA diploid6 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,  dominance relationships # determine how the genes will be  expressed in the agent.  Minimal complete definition: . $Given two possible forms of a gene,  takes into : account any dominance relationship, and returns a gene  representing the result. 4Products: encode multiple arguments to constructors )Sums: encode choice between constructors +Meta-information (constructor names, etc.) 9Constants, additional parameters and recursion of kind * .Unit: used for constructors without arguments portable experimentalamy@nualeargais.ie Safe-Inferred ;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. 5Return the portion of the genome that has been read. 6Write a Word8 value to the genome without encoding it 7Read a Word8 value from the genome without decoding it Return the entire genome. 5Return 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 3 (unread) portion of the two nucleotide strands. 4Products: encode multiple arguments to constructors )Sums: encode choice between constructors +Meta-information (constructor names, etc.) 9Constants, additional parameters and recursion of kind * .Unit: used for constructors without arguments '    "  portable experimentalamy@nualeargais.ie Safe-Inferred ;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. ,5Return the portion of the genome that has been read. /Return the entire genome. 05Return the portion of the genome that has been read. 1;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 3 (unread) portion of the two nucleotide strands. 4Products: encode multiple arguments to constructors )Sums: encode choice between constructors +Meta-information (constructor names, etc.) 9Constants, additional parameters and recursion of kind * .Unit: used for constructors without arguments ( !"#$%&'()*+,-./012 !"#$%&'()*+,-./012 !"#&%'($)*+,-.12/0# !"#$%&'()*+,-./012portable experimentalamy@nualeargais.ieNone37A database offering storage and retrieval for records. 5(Get a list of all keys in the database. 6!Read a record from the database. 7!Write a record to the database. J If an agent with the same name already exists, it will be overwritten. 8#Remove a record from the database. F The database may archive records rather than simply deleting them. 3456789:3456789:3456789:3456789:portable experimentalamy@nualeargais.ieNone;CA simple database where each record is stored in a separate file, ) and the name of the file is the record's key. << d# (re)creates the FSDatabase in the  directory d. Read a record from a file. Write a record to a file. ;<;<;< ;<portable experimentalamy@nualeargais.ieNoneEE username sleepTime state task creates a daemon  running as username, which invokes task repeatedly, sleeping  for  sleepTime% microseconds between invocations of task. =>?@ABCDE =>?@ABCDE =>?@ABCDE=>?@ABCDEportable experimentalamy@nualeargais.ieNone FFrom  1http://www.haskell.org/haskellwiki/Random_shuffle GG xs n x returns a copy of xs in which the nth 1 element (if it exists) has been replaced with x. HH xs n x returns a copy of xs in which the nth " element has been replaced with x. Causes an exception if xs has  fewer than n+1 elements. Compare with G. I Assuming xs; is a sequence containing the elements of a square matrix,  I 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.   a 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 y 8We 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  I 3 ['a'..'y'] returns. J Assuming xs8 is a sequence containing the elements of a matrix with k  columns, J (a,b) (c, d) k xs returns the elements of the  submatrix from (a,b) in the upper left corner to (c,d) in the lower  right corner). ! Note: Matrix indices begin at (0,0). Example: Suppose we have a 4x6# matrix and we want to extract the 8 submatrix from (1,2) to (2,4), as illustrated below.   a 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 x 8We 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 J (1,2) (2,4) 6 ['a'..'x']  returns. KK n? returns the greatest integer not greater than the square root  of n. LL n m7 returns the greatest integer not greater than the log  base n of m. MM n returns True if n is a perfect square (i.e., if 2 there exists an _integer_ m such that m*m = n) Nn N m returns True if n is a power of m (i.e., if 2 there exists an _integer_ k such that m^k = n) R&Convert a list of bits to a string of 0s and 1s. SShow  non-negative  numbers in binary. FGHIJKLMNOPQRSFGHIJKLMNOPQRSLNKMJIHOQGFRSPFGHIJKLMNOPQRS portable experimentalamy@nualeargais.ieNoneTAn encoding scheme. X?Encodes a value as a sequence of letters in the code alphabet. Y?Encodes a value and append it to the sequence provided. If the A value cannot be encoded, the sequence is returned unmodified. Z@Returns the value corresponding to a sequence of letters in the  code alphabet. [?Decodes a value from a sequence, and returns the value and the # unused portion of the sequence. TUVWXYZ[TUVWXYZ[TUVWXYZ[TUVWXYZ[ portable experimentalamy@nualeargais.ieNone \@Cuts two lists at the specified locations, swaps the ends, and . splices them. The resulting lists will be:    a[0..n-1] ++ b[m..]  b[0..m-1] ++ a[n..]    Here are some examples.     Expression Result  \ 2 5 ("abcdef", "ABCDEF") ("abF"," ABCDEcdef")  \ 3 1 ("abcd", "ABCDEFG") (" abcBCDEFG","Ad")  \ 4 4 ("abcdef", "ABCDEF") ("abcdEF","ABCDef")    If n < = 0 or m <5= 0, the corresponding input list will be completely  transferred to the other.     Expression Result  \ 0 4 ("abcdef", "ABCDEF") ("EF"," ABCDabcdef")  \ (-2) 4 ("abcd", "ABCDEFGH") ("EFGH","ABCDabcd")  \ 5 0 ("abcdef", "ABCDEF") (" abcdeABCDEF","f")   L If n or m are greater than or equal to length of the corresponding list, & that list will not be transferred.     Expression Result  \ 10 0 ("abcdef", "ABCDEF") (" abcdefABCDEF","")  \ 0 0 ("", "ABCDEF" ) ("ABCDEF","")   ]Same as \$, except that the two locations are  chosen at random. ^?Cuts two lists at the specified location, swaps the ends, and ( splices them. This is a variation of \ where n == m. _Same as ^), except that the location is chosen at  random. `&Mutates a random element in the list. a0Mutates a random element in one list in a pair. b6Performs an operation with the specified probability. c0Performs an operation a random number of times. . The probability of repeating the operation n times is p^n. IRandomly select a boolean, but weighted to return True with probability  p. HChoose an element at random from a list and return the element and its  index \]^_`abcde \]^_`abcde ^\`aed_]cb \]^_`abcde portable experimentalamy@nualeargais.ie Safe-InferredfAn artificial life species. B All species used in Cratr must be an instance of this class. gReturns the agent ID. h5Returns True if the agent is alive, false otherwise. i&A unique ID associated with an agent. j8The internal clock used by Cratr is a simple counter. fghijfghijfghijfghij portable experimentalamy@nualeargais.ie Safe-Inferredk5A clock representing the time in a Cratr universe. E 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 m is called. > This allows Cratr to run without being affected by other < processes which might be using the CPU at the same time. lThe current time, measured in ticks mAdvance the clock to the next tick. klmklmklmklm portable experimentalamy@nualeargais.ie Safe-InferredrCCreates a counter that will store its value in the specified file. nopqrnopqropqnrnopqrportable experimentalamy@nualeargais.ieNoneu.Assign a unique ID using the supplied prefix. stuvstuvtusvstuvportable experimentalamy@nualeargais.ieNonew?A species that reproduces, transmitting genetic information to : its offspring. Minimal complete definition: all except mate. x3A sequence of hereditary information for an agent. y>Recombines the genetic information from two parents, creating 0 genetic information for potential offspring. -Typically this involves the following steps: < Recombine the two strands of genetic information (one from . each parent) to obtain two new strands. 3 Discard one strand, and return the remaining one. z@Builds 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 y# to create a genome for the child.  Calls z( to construct a child with this genome. wxyz{wxyz{wxyz{wxyz{portable experimentalamy@nualeargais.ieNone|?A species that reproduces, transmitting genetic information to : its offspring. Minimal complete definition: all except mate. }3A sequence of hereditary information for an agent. # The type signature for the agent' s genome is  (Base a, Base a). ~ From the two/ strands of the genetic information from this  agent, creates a single$ strand that will contribute to the  child' s genome. A (This is analogous to creating either a single sperm or ova.) @Builds 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 produce a single strand of genetic $ information from each parent. 9 Pairs the two strands to create a genome for the child.  Calls % construct a child with this genome. |}~|}~|}~|}~portable experimentalamy@nualeargais.ieNone&A habitat containing artificial life. portable experimentalamy@nualeargais.ieNone@A program which allows an agent to interact with one or more of  its neighbours. @The input parameter is a list of agents. The first agent in the B list is the agent whose turn it is to use the CPU. The rest of D the list contains agents it could interact with. For example, if C agents reproduce sexually, the program might check if the first G agent in the list is female, and the second one is male, and if so, D mate them to produce offspring. The input list is generated in a E way that guarantees that every possible sequence of agents has an  equal chance of occurring. ?The program must return a list of agents that it has modified. ; (The universe will then be updated with these changes.) 2 The order of the output list is not important. "A program for an agent which doesn't interact with other agents. E The input parameter is the agent whose turn it is to use the CPU. E The program must return the agent (which may have been modified). ; (The universe will then be updated with these changes.)   !"#$%&'()*+,-./0 !"#$%&'(+,-./0123456789:;;<=>?@ABCDEFGHIJKLMNOP Q Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m nopqrstuvwstxvwyyz{|}~9 j o creatur-3.0.0ALife.Creatur.LoggerALife.Creatur.Genetics.Diploid ALife.Creatur.Genetics.BRGCWord8ALife.Creatur.Genetics.BRGCBoolALife.Creatur.Database!ALife.Creatur.Database.FileSystemALife.Creatur.DaemonALife.Creatur.UtilALife.Creatur.Genetics.Code$ALife.Creatur.Genetics.Recombination ALife.CreaturALife.Creatur.ClockALife.Creatur.CounterALife.Creatur.AgentNamer+ALife.Creatur.Genetics.Reproduction.Asexual*ALife.Creatur.Genetics.Reproduction.SexualALife.Creatur.UniverseALife.Creatur.Universe.TaskSimpleRotatingLoggerLogger writeToLogmkSimpleRotatingLoggerDiploidexpress expressMaybe DiploidReaderDiploidSequenceGeneticputgetgetWithDefaultReaderWriterSequencewrite runWriterread runReadercopyconsumed putRawWord8 getRawWord8readAndExpressrunDiploidReadercopy2 consumed2 getAndExpressgetAndExpressWithDefaultDatabaseDBRecordkeyslookupstoredeleteRecordkey FSDatabase mkFSDatabaseDaemon onStartup onShutdown onExceptiontaskusername sleepTimelaunchshufflesafeReplaceElementreplaceElement cropSquarecropRectisqrtilogBase perfectSquare isPowerOf reverseLookupstateMaprotate boolsToBitsshowBinCodecSizecTableencode encodeNextdecode decodeNext cutAndSplicerandomCutAndSplice crossoverrandomCrossover mutateListmutatePairedListswithProbabilityrepeatWithProbabilityrandomOneOfPairrandomOneOfListAgentagentIdisAliveAgentIdTimeClock currentTimeincTimePersistentCounterCountercurrent incrementmkPersistentCounterSimpleAgentNamer AgentNamergenNamemkSimpleAgentNamer ReproductiveBase recombinebuild makeOffspring produceGameteUniverse_clock_logger_agentDB_namer_extraSimpleUniverseagentDBclockextraloggeragentIds multiLookupstoreOrArchiveaddAgentmkSimpleUniverse AgentsProgram AgentProgram simpleDaemonstartupHandlershutdownHandlerexceptionHandler withAgentrunNoninteractingAgents withAgentsrunInteractingAgents initialised directory logFilename expFilenamemaxRecordsPerFile recordCount initIfNeeded initialisewrite'bumpRecordCount rotateLog$fLoggerSimpleRotatingLogger $fGDiploidK1 $fGDiploidM1 $fGDiploid:+: $fGDiploid:*: $fGDiploidU1GDiploidgexpress$fDiploidMaybe $fDiploid[]$fDiploidDouble$fDiploidWord64$fDiploidWord32$fDiploidWord16$fDiploidWord8 $fDiploidWord $fDiploidInt $fDiploidChar $fDiploidBool $fGGeneticK1 $fGGeneticM1 $fGGenetic:+: $fGGenetic:*: $fGGeneticU1GGeneticgputgget word8ToBool$fGeneticMaybe $fGenetic[]$fGeneticWord16$fGeneticWord8 $fGeneticChar $fGeneticBoolputRawBoolArraygetRawBoolArray intToBools boolsToInt readRecord3 writeRecord3mainDir archiveDir writeRecord2isRecordFileName$fDatabaseFSDatabase termReceiveddaemonUsername daemonMaindaemonMainLoop handleTERMbaseGHC.RealIntegral safeSliceweightedRandomBooleanrandomListSelectiontimefilename$fClockPersistentCounter$fCounterPersistentCounterprefixcounter withCounter$fAgentNamerSimpleAgentNamernamer$fAgentNamerUniverse$fClockUniverse$fLoggerUniverse withAgent' withAgents' makeViews