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)); }
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)); }
public static ChromosomeStats FromString(string str) { var parts = str.Split(':'); return(new ChromosomeStats(parts[0], CreatureStats.Decode(parts[1]))); }