Saturday, September 16, 2023

DNA Sequencer

 This is John Doe's DNA:

John Doe,T,A,C,G,C,T,A,T,T

These are other animals:

Arctic Fox,T,A,C,C,T,A,C,T,T,A,C,G,A,T,G,T,G,T,A,G,C,A,C,A,T,C,T,G,G,A,T,G,C,T,C,C,T,T,C,T,A,C,G,C,G,G,T,A,A,T,A,T,C,C,T,G,T,G,G,A,T,G,G,A,C,G,G,A,G,C,T,A,C,C,G,C,T,T,T,C,T,T,G,C,G,G,A,G,G,T,G,A,T,C,A,C,C,T,G,A,C,T


Glow Worm,T,A,C,C,T,A,C,T,T,A,C,G,A,A,C,A,C,T

Eastern Diamondback Rattlesnake,T,A,C,G,C,C,T,A,G,G,C,G,G,T,A,A,T,C

Domestic Cat,T,A,C,G,G,G,T,A,G,C,T,A,G,C,C,A,T,T


Great Dane,T,A,C,T,T,G,T,C,A,T,G,G,C,T,C,T,C,G,T,A,G,C,T,T,T,C,T,A,A,T,G,A,A,C,C,G,T,T,C,T,A,T,T,G,A,A,C,A,G,T,T,A,G,A,T,G,G,A,G,C,T,C,C,C,T,C,A,A,T,C,C,C,T,T,A,C,C,A,A,G,T,C,C,T,C,T,C,A,A,G,C,G,C,C,A,C,\

A,C,C,A,C,T

Alaskan Malmute,T,A,C,C,T,G,T,C,G,A,G,G,A,C,C,C,T,C,A,G,A,C,C,T,G,A,G,T,T,A,G,C,A,C,G,G,T,A,G,G,T,G,T,C,T,G,G,C,G,T,G,C,C,G,G,A,T,G,C,G,C,A,T,A,T,G,T,T,C,T,T,T,G,C,T,C,T,C,A,A,G,A,C,C,G,A,A,G,T,C,C,C,G,G\

,C,T,A,G,G,A,T,C

Golden Retriever,T,A,C,A,C,C,T,G,T,A,A,C,G,T,T,A,G,T,A,G,T,C,G,A,G,T,A,C,C,A,C,T,T,T,A,A,T,G,C,A,C,A,T,C,T,T,C,C,A,A,C,G,A,C,G,A,C,G,T,A,G,T,C,G,A,T,T,A,G,A,A,G,A,G,C,C,T,A,C,G,G,A,A,C,C,C,G,C,G,G,G,G,T,\

T,C,G,A,A,T,A,T,T


The fund-a is simpler organisms need not necessarily have more complex DNA.

Now cell division happens in two types. Meiosis and Mitosis. Mitosis is normal division and Meiosis results in haploid cells with half the number of Strands.

The thing is DNA transcription happens with the involvement of messenger RNAs.

I have a partly written code for this which did not completely work.

Here is some sample:

string Sequencer::Convert(const string trinucleotide){
  if((trinucleotide=="AUU")||(trinucleotide=="AUC")||(trinucleotide=="AUA"))
    return ("Isoleucine");
  else if((trinucleotide=="CUU")||(trinucleotide=="CUC")||(trinucleotide=="CUA")||
          (trinucleotide=="CUG")|| (trinucleotide=="UUA")||(trinucleotide=="UUG"))
    return ("Leucine");
  else if((trinucleotide=="GUU")||(trinucleotide=="GUC")||
          (trinucleotide=="GUA")||(trinucleotide=="GUG"))
    return ("Valine");
  else if((trinucleotide=="UUU")||(trinucleotide=="UUC"))
    return ("Phenylalanine");
  else if((trinucleotide=="AUG"))
    return ("Methionine (START)");
  else if((trinucleotide=="UGU")||(trinucleotide=="UGC"))
    return ("Cysteine");
  else if((trinucleotide=="GCU")||(trinucleotide=="GCC")||
          (trinucleotide=="GCA")||(trinucleotide=="GCG"))
    return ("Alanine");
  else if((trinucleotide=="GGU")||(trinucleotide=="GGC")||
          (trinucleotide=="GGA")||(trinucleotide=="GGG"))
    return ("Glycine");
  else if((trinucleotide=="CCU")||(trinucleotide=="CCC")||
          (trinucleotide=="CCA")||(trinucleotide=="CCG"))
    return ("Proline");
  else if((trinucleotide=="ACU")||(trinucleotide=="ACC")||
          (trinucleotide=="ACA")||(trinucleotide=="ACG"))
    return ("Threonine");
  else if((trinucleotide=="UCU")||(trinucleotide=="UCC")||
          (trinucleotide=="UCA")||(trinucleotide=="UCG")||
          (trinucleotide=="AGU")||(trinucleotide=="AGC"))
    return ("Serine");
  else if((trinucleotide=="UAU")||(trinucleotide=="UAC"))
    return ("Tyrosine");
  else if((trinucleotide=="UGG"))
    return ("Tryptophan");
  else if((trinucleotide=="CAA")||(trinucleotide=="CAG"))
    return ("Glutamine");
  else if((trinucleotide=="AAU")||(trinucleotide=="AAC"))
    return ("Asparagine");
  else if((trinucleotide=="CAU")||(trinucleotide=="CAC"))
    return ("Histidine");
  else if((trinucleotide=="GAA")||(trinucleotide=="GAG"))
    return ("Glutamic acid");
  else if((trinucleotide=="GAU")||(trinucleotide=="GAC"))
    return ("Aspartic acid");
  else if((trinucleotide=="AAA")||(trinucleotide=="AAG"))
    return ("Lysine");
  else if((trinucleotide=="CGU")||(trinucleotide=="CGC")||(trinucleotide=="CGA")||
          (trinucleotide=="CGG")||(trinucleotide=="AGA")||(trinucleotide=="AGG"))
    return ("Arginine");
  else if((trinucleotide=="UAA")||(trinucleotide=="UAG")||(trinucleotide=="UGA"))
    return ("Stop");
else
    cout << "returning unknown" << endl;
  return ("Unknown");
}

Also the sequencing either happens completely or not at all. There is nothing like half the DNA is copied and other half of the sequence isn't as I thought might happen earlier.

The reference repo is not working properly but you can make it work.

Potion Craft

 Another stupider game.

Here there are things like potions of various types in a file. We are supposed to read the file, populate our data structures, increment the ingredients if two of them combine to form a more complex ingredient. Final is the philosopher's stone or something.

//Constants (Do not edit)                                                                                                                                                                                  
const int PROJ2_SIZE = 29;
const int RANK_D = 30;
const int RANK_C = 50;
const int RANK_B = 70;
const int RANK_A = 90;
const int RANK_S = 100;

The score keeps incrementing as an when you get more and more complex ingredients made.

If you get all ingredients and stone your score reaches 100 and you win.

These are the ingredients and their secret recipes.

Firebell,natural,none,none

Waterbloom,natural,none,none

Terraria,natural,none,none

Windbloom,natural,none,none

Mad Mushroom,natural,none,none

Witch's Mushroom,natural,none,none

Featherbloom,natural,none,none

Healing,potion,Waterbloom,Terraria

Poison,potion,Terraria,Firebell

Frost,potion,Waterbloom,Waterbloom

Fire,potion,Firebell,Firebell

Explosion,potion,Mad Mushroom,Mad Mushroom

Swiftness,potion,Windbloom,Windbloom

Mana,potion,Witch's Mushroom,Witch's Mushroom

Lightning,potion,Thunder Thistle,Windbloom

Strength,potion,Terraria,Terraria

Stone Skin,potion,Firebell,Waterbloom

Sleep,potion,Lifeleaf,Waterbloom

Dexterity,potion,Waterbloom,Windbloom

Light,potion,Windbloom,Firebell

Rage,potion,Bloodthorn,Featherbloom

Charm,potion,Mad Mushroom,Windbloom

Levitation,potion,Mad Mushroom,Witch's Mushroom

Invisibility,potion,Witch's Mushroom,Windbloom

Nigredo,reagent,Poison,Stone Skin

Albedo,reagent,Nigredo,Frost

Citrinitas,reagent,Albedo,Fire

Rubedo,reagent,Citrinitas,Healing

Philosopher's Stone,legendary,Rubedo,Invisibility

Here is a repo for reference.

Bloons Game

 A stupid game demonstrating several patterns in the code.

//**Constants related to starting game**                                                                                                                                                                    
const int START_ROUND = 1; //Starting round                                                                                                                                                                
const int START_LIFE = 100; //Starting life (num damage before losing game)                                                                                                                                
const int START_MONEY = 10; //Starting money for player                                                                                                                                                    

//Constants related to the length of the path                                                                                                                                                              
const int PATH_LENGTH = 3; //Length of the path (could be anything)                                                                                                                                        
const int START_BLOON = -1; //Starting location of all bloons                                                                                                                                              

//**Constants related to money/cost**                                                                                                                                                                      
const int COST_DART = 2; //Starting cost for dart monkey                                                                                                                                                    
const int COST_BOOMERANG = 4; //Starting cost for boomerang monkey                                                                                                                                          
const int COST_BOMB = 6; //Starting cost for a bomb monkey                                                                                                                                                  
const int COST_IMPROVE = 2; //Cost for each improvement (regardless of type)                                                                                                                                
const int EARN_POP = 1; //Earnings per pop of a bloon                                                                                                                                                      
const int IMPROVE_VALUE = 2; //When a bloon is improved, increases the value based on this                                                                                                                  

//**Constants related to damage**                                                                                                                                                                          
const int DAMAGE_DART = 1; //Starting damage for dart monkey                                                                                                                                                
const int DAMAGE_BOOM = 1; //Starting damage for boomerage monkey                                                                                                                                          
const int DAMAGE_BOMB = 1; //Starting damage for bomb monkey                                                                                                                                                
//******************************************************

The project has three types of Baloons. Dart, Boomerang and Bomb. Each are deriving from Monkey.

Basic is deriving from Bloon.

Monkey is a stand alone class.

This project demonstrates the concept of inheritance and polymorphism.

Here is a repo for reference.