public bool Compare(Phrase compare, out int exactMatch, out int partialMatch) { bool result = false; CCount matchCount = new CCount(); char[] outer = this.CharValue(); char[] inner = compare.CharValue(); // this outer for (int i = 0; i < PhraseSize; i++) { // compare inner for (int j = 0; j < PhraseSize; j++) { //exact match if (outer[i] == inner[j] && i == j) { switch (outer[i]) { case 'G': matchCount.G++; break; case 'A': matchCount.A++; break; case 'T': matchCount.T++; break; case 'C': matchCount.C++; break; } } } } exactMatch = matchCount.G + matchCount.A + matchCount.T + matchCount.C; // (if actual > 0 ? ((if guess >= actual ? actual : guess) - matchcount) : 0) + ... partialMatch = (this.Count.G > 0 ? (compare.Count.G >= this.Count.G ? this.Count.G : compare.Count.G) - matchCount.G : 0) + (this.Count.A > 0 ? (compare.Count.A >= this.Count.A ? this.Count.A : compare.Count.A) - matchCount.A : 0) + (this.Count.T > 0 ? (compare.Count.T >= this.Count.G ? this.Count.T : compare.Count.T) - matchCount.T : 0) + (this.Count.C > 0 ? (compare.Count.C >= this.Count.C ? this.Count.C : compare.Count.C) - matchCount.C : 0); if (exactMatch == PhraseSize) { result = true; } return(result); }
public Phrase(string phrase = null) { if (string.IsNullOrEmpty(phrase)) { _value = ""; Random random = new Random(); for (int i = 0; i < PhraseSize; i++) { switch (random.Next(0, 4)) { case 0: _value += "G"; break; case 1: _value += "A"; break; case 2: _value += "T"; break; case 3: _value += "C"; break; } } } else { _value = phrase; //TODO also check the length!!! } _count = new CCount(); if (!SetCheckLetterCounts()) { //TODO: invalid Phrase passed } }
public bool Compare(Phrase compare, out int exactMatch, out int partialMatch) { bool result = false; CCount matchCount = new CCount(); char[] outer = this.CharValue(); char[] inner = compare.CharValue(); // this outer for (int i = 0; i < PhraseSize; i++) { // compare inner for (int j = 0; j < PhraseSize; j++) { //exact match if (outer[i] == inner[j] && i == j) { switch (outer[i]) { case 'G': matchCount.G++; break; case 'A': matchCount.A++; break; case 'T': matchCount.T++; break; case 'C': matchCount.C++; break; } } } } exactMatch = matchCount.G + matchCount.A + matchCount.T + matchCount.C; // (if actual > 0 ? ((if guess >= actual ? actual : guess) - matchcount) : 0) + ... partialMatch = (this.Count.G > 0 ? (compare.Count.G >= this.Count.G ? this.Count.G : compare.Count.G) - matchCount.G : 0) + (this.Count.A > 0 ? (compare.Count.A >= this.Count.A ? this.Count.A : compare.Count.A) - matchCount.A : 0) + (this.Count.T > 0 ? (compare.Count.T >= this.Count.G ? this.Count.T : compare.Count.T) - matchCount.T : 0) + (this.Count.C > 0 ? (compare.Count.C >= this.Count.C ? this.Count.C : compare.Count.C) - matchCount.C : 0); if (exactMatch == PhraseSize) { result = true; } return result; }
public Phrase(string phrase = null) { if (string.IsNullOrEmpty(phrase)) { _value = ""; Random random = new Random(); for (int i = 0; i < PhraseSize; i++) { switch (random.Next(0,4)) { case 0: _value += "G"; break; case 1: _value += "A"; break; case 2: _value += "T"; break; case 3: _value += "C"; break; } } } else { _value = phrase; //TODO also check the length!!! } _count = new CCount(); if (!SetCheckLetterCounts()) { //TODO: invalid Phrase passed } }