public Genome(XDocument info) : base(int.Parse(info.Root.Attribute(XName.Get("Length")).Value)) { // Loading brain structure XElement structure = info.Root.Element(XName.Get("BrainStructure")); BrainStructure = new BrainStructure() { InputCount = int.Parse(structure.Attribute(XName.Get("InputCount")).Value), TypeID = int.Parse(structure.Attribute(XName.Get("TypeID")).Value), MemoryBitCount = int.Parse(structure.Attribute(XName.Get("MemoryBitCount")).Value) }; var levels = structure.Element(XName.Get("Levels")).Elements(XName.Get("Level")); BrainStructure.LevelSizes = new int[levels.Count()]; int levelNr = 0; foreach (XElement level in levels) { BrainStructure.LevelSizes[levelNr++] = int.Parse(level.Value); } // Loading genome Load(info.Root.Element(XName.Get("Data")).Value); }
public Genome(BrainStructure brainStructure) : base(brainStructure.GenomeLength) { BrainStructure = brainStructure; }