Exemple #1
0
    public void MakeBrain()
    {
        var OpCodes = new List <OpCode.IOpCode>
        {
            new OpCode.Type0()
        };
        var Type0SVRule = new SVRule(OpCodes);
        var StateSVRule = new SVRule(new List <OpCode.IOpCode>
        {
            new OpCode.State()
        });
        var          Type0NeuronGene         = new NeuronGene(0, 0, 255, Type0SVRule);
        var          StateNeuronGene         = new NeuronGene(0, 0, 255, StateSVRule);
        var          DendriteDynamics        = new DendriteDynamicsGene(0, 0, 0, StateSVRule, 0, null, 0, null, null, 0);
        DendriteGene DendriteGene            = new DendriteGene(0, BrainLobeType.Drive, DendriteGene.SpreadType.Flat, 0, new Vector2Int(1, 1), new Vector2Int(255, 255), new Vector2Int(255, 255), DendriteDynamics);
        DendriteGene DendriteGeneNoDendrites = new DendriteGene(0, BrainLobeType.Perception, DendriteGene.SpreadType.Flat, 0, new Vector2Int(0, 0), new Vector2Int(1, 1), new Vector2Int(1, 1), DendriteDynamics);
        // Destination lobe
        var LobeGene1 = new LobeGene(BrainLobeID.Perception, new Vector2Int(1, 1), new Vector2Int(1, 1), DendriteGene, DendriteGene, Type0NeuronGene, 0, 0);
        // Source lobe
        var LobeGene2 = new LobeGene(BrainLobeID.Drive, new Vector2Int(1, 1), new Vector2Int(1, 1), DendriteGeneNoDendrites, DendriteGeneNoDendrites, StateNeuronGene, 0, 0);

        Brain      = new Brain();
        DestLobe   = LobeBuilder.BuildFromGene(LobeGene1, 1, 1);
        SourceLobe = LobeBuilder.BuildFromGene(LobeGene2, 1, 1);
        Brain.AddLobe(DestLobe);
        Brain.AddLobe(SourceLobe);

        DestLobe.SetUpDendrites(Brain);
    }
Exemple #2
0
    public void SetUpLobes()
    {
        var PerceptionLobe           = Lobes[0];
        int OffsetIntoPerceptionLobe = 0;

        foreach (var Lobe in Lobes)
        {
            if (Lobe.CopyToPerceptionLobe)
            {
                Lobe.SetUpPerceptionLobeLink(OffsetIntoPerceptionLobe, PerceptionLobe);
                OffsetIntoPerceptionLobe += Lobe.NumNeurons;
            }
            Lobe.SetUpDendrites(this);
        }
        RenderableLobes = new List <Lobe>(Lobes);
    }