Esempio n. 1
0
        public static ChromosomeData Decode(JObject json)
        {
            var chromosome = json[CodingKey.Chromosome].ToFloatArray();
            var statsJSON  = json[CodingKey.CreatureStats] as JObject;
            var stats      = CreatureStats.Decode(statsJSON);

            return(new ChromosomeData(chromosome, stats));
        }
Esempio n. 2
0
        public static StringChromosomeData Decode(JObject json)
        {
            string chromosome = json[CodingKey.Chromosome].ToString();
            var    statsJSON  = json[CodingKey.CreatureStats] as JObject;
            var    stats      = CreatureStats.Decode(statsJSON);

            return(new StringChromosomeData(chromosome, stats));
        }
Esempio n. 3
0
    public static ChromosomeStats FromString(string str)
    {
        var parts = str.Split(':');

        return(new ChromosomeStats(parts[0], CreatureStats.Decode(parts[1])));
    }