static public Gen Parse(string FormatedString) { var b = FormatedString.Split(' '); if (b[0] == "rsid" || b.Length != 4) { return(null); } Chromosone TryP; TryP = Chromosone.TryParse(b[1], out TryP) ? TryP : Chromosone.NaC; var Gtype = (from Geenon in b[3] select Geenon == 'A' ? GenomType.A : ( Geenon == 'C' ? GenomType.C : ( Geenon == 'G' ? GenomType.G : Geenon == 'T' ? GenomType.T : GenomType.NaG))).ToList(); if (Gtype.Count == 1) { Gtype.Add(GenomType.NaG); } int numb; if (!int.TryParse(b[2], out numb)) { numb = 0; } return(new Gen(b[0], TryP, numb, Gtype.ToArray())); }
public Gen(string Rsid, Chromosone Chromo, int Position, GenomType[] GeenoTypes) { this.Rsid = Rsid; this.Chromosone = Chromo; this.Position = Position; this.GeenoTypes = GeenoTypes; }
public Solution(bool init = true) { Moves = new Chromosone[Chromosones * 2]; if (init) { for (int i = 0; i < Chromosones * 2; i++) { Moves[i] = new Chromosone(); Mutate(i, true); } } Score = -1; }
internal static void Output(Chromosone chromosone, Wizard wizard) { int power = 150; if (wizard.Carrying) { chromosone.Action = "THROW"; power = MaxPower; } else { chromosone.Action = "MOVE"; power = MaxThrust; } var a = chromosone.Angle * Math.PI / 180; double px = wizard.X + Math.Cos(a) * 10000; double py = wizard.X + Math.Sin(a) * 10000; Console.WriteLine(string.Format("{0} {1} {2} {3}", chromosone.Action, Math.Round(px), Math.Round(py), power)); }
public ChromosoneWithFitness(Chromosone chromosone, double rating) { Rating = rating; Chromosone = chromosone; }