Exemple #1
0
 private String rnaString() {
   String ret = "";
   for (DNANucleotide nuc : nucleotides) {
     ret += nuc.partnerType();
   }
   return ret;
 }
Exemple #2
0
 public String toString() {
   String ret = "";
   for (DNANucleotide nuc : nucleotides) {
     ret += nuc.type();
   }
   return ret;
 }
Exemple #3
0
  public boolean computeValidity() {
    Game.State state;

    if (!isComplete()) return false;

    if (this.exactMatch()) state = Game.State.Good;
    else if (Game.codonGroups.sameGroup(Game.dnaToRNA(this.toString()), this.rnaString()))
      state = Game.State.Acceptable;
    else {
      state = Game.State.Bad;
    }

    // Update score
    game.score.codonCompleted(state);

    for (DNANucleotide dna : nucleotides) {
      dna.setState(state);
    }

    return true;
  }
Exemple #4
0
 private boolean allOffScreen() {
   for (DNANucleotide dna : nucleotides) {
     if (!dna.offScreen()) return false;
   }
   return true;
 }
Exemple #5
0
 // Have all the DNA bases in this codon been attached?
 // Doesn't matter if they're correctly attached or not
 public boolean isComplete() {
   for (DNANucleotide dna : nucleotides) {
     if (!dna.attached()) return false;
   }
   return true;
 }
Exemple #6
0
 public boolean exactMatch() {
   for (DNANucleotide dna : nucleotides) {
     if (!dna.matchesPartner()) return false;
   }
   return true;
 }