Beispiel #1
0
        public void WhenCreatureContextCreated_EnergyShouldBeCorrect()
        {
            byte[] genes = GenerateRandomGenome(256);

            Incubator incubator = new Incubator();

            CreatureCreationContext context = incubator.GenerateContext(genes);

            byte energy = genes [genes [incubator.Positions [Incubator.GenePosition.StartEnergyPosition]]];

            Assert.AreEqual(energy, context.Energy);
        }
Beispiel #2
0
        public void WhenCreatureContextCreated_CostOfEnzymeProcessingShouldBeCorrect()
        {
            byte[] genes = GenerateRandomGenome(256);

            Incubator incubator = new Incubator();

            var context = incubator.GenerateContext(genes);

            int position = genes [incubator.Positions [Incubator.GenePosition.CostOfEnzymeProcessingPosition]];

            byte costOfEnzymeProcessing = genes [position];

            Assert.AreEqual(costOfEnzymeProcessing, context.CostOfEnzymeProcessing);
        }
Beispiel #3
0
        public void WhenCreatureContextCreated_CostOfDigestionShouldBeCorrect()
        {
            byte[] genes = GenerateRandomGenome(256);

            Incubator incubator = new Incubator();

            var context = incubator.GenerateContext(genes);

            int position = genes [incubator.Positions [Incubator.GenePosition.CostOfDigestionRatioPosition]];

            byte costOfDigestion = genes [position];

            Assert.AreEqual(Math.Max((byte)1, costOfDigestion), context.CostOfDigestion);
        }
Beispiel #4
0
        public void WhenCreatureContextCreated_SmallGenome_EnergyShouldBeCorrect()
        {
            int genomeLength = 8;

            byte[] genes = GenerateRandomGenome(genomeLength);

            Incubator incubator = new Incubator();

            CreatureCreationContext context = incubator.GenerateContext(genes);

            int position = genes [incubator.Positions [Incubator.GenePosition.StartEnergyPosition]];

            Assert.AreEqual(genes [position], context.Energy);
        }
Beispiel #5
0
        public void WhenCreatureContextCreated_EnzymesShouldBeCorrectLength()
        {
            byte[] genes = GenerateRandomGenome(256);

            Incubator incubator = new Incubator();

            var context = incubator.GenerateContext(genes);

            int position = incubator.Positions [Incubator.GenePosition.LengthOfEnzymeChainPosition];

            int length = genes [position];

            Assert.AreEqual(length, context.Enzymes.Count);
        }
Beispiel #6
0
        public void WhenCreatureContextCreated_MaxEnergyShouldBeCorrect()
        {
            byte[] genes = GenerateRandomGenome(256);

            Incubator incubator = new Incubator();

            var context = incubator.GenerateContext(genes);

            int position = genes [incubator.Positions [Incubator.GenePosition.MaxEnergyPosition]];

            byte maxEnergyPosition = genes [position];

            Assert.AreEqual(maxEnergyPosition, context.EnergyMaximum);
        }
Beispiel #7
0
        public void WhenCreatureContextCreated_SmallGenome_CostOfDigestionShouldBeCorrect()
        {
            int genomeLength = 8;

            byte[] genes = GenerateRandomGenome(genomeLength);

            Incubator incubator = new Incubator();

            var context = incubator.GenerateContext(genes);

            int position = genes [incubator.Positions [Incubator.GenePosition.CostOfDigestionRatioPosition]];

            byte cost = genes [position];

            Assert.AreEqual(cost, context.CostOfDigestion);
        }