static void Main(string[] args) { Morph M1 = new Morph() { MorphID = 1, het = false, MorphName = "M1" }; Morph M2 = new Morph() { MorphID = 2, het = false, MorphName = "M2" }; Morph M3prime = new Morph() { MorphID = 3, het = true, MorphName = "M3" }; Morph M4prime = new Morph() { MorphID = 4, het = true, MorphName = "M4" }; Morph Mfour = new Morph() { MorphID = 7, het = false, MorphName = "M4" }; Morph Mfive = new Morph() { MorphID = 8, het = false, MorphName = "M5" }; Morph Mfiveprime = new Morph() { MorphID = 9, het = true, MorphName = "M5" }; Lizard L1 = new Lizard() { LizardID = 1, Name = "Liz 1" }; Lizard L2 = new Lizard() { LizardID = 2, Name = "Liz 2" }; L1.Morphs = new List <Morph>() { M1, M2, M3prime, M4prime }; L2.Morphs = new List <Morph>() { M1, M3prime, Mfour, Mfiveprime }; var total = Compute(L1, L2); foreach (var x in total) { Console.WriteLine(x); } }
public MorphPlus(Morph one, Morph two) { // one will never be null(normal), it can only be truebreed or het // two can be null(normal) or truebreed or het MorphName = one.MorphName; MorphOne = one; MorphTwo = two; // two is null = normal if (two == null) { // het to normal if (one.het) { PercentNormal = 50; PercentHet = 50; PercentTrue = 0; } // truebreed to normal else { PercentNormal = 0; PercentHet = 100; PercentTrue = 0; } } else if (one.het == two.het) { // het to het if (one.het) { PercentNormal = 25; PercentHet = 50; PercentTrue = 25; } // truebreed to truebreed else { PercentNormal = 0; PercentHet = 0; PercentTrue = 100; } } else // het to truebreed (or truebreed to het) { PercentNormal = 0; PercentHet = 50; PercentTrue = 50; } }