Exemplo n.º 1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     button.Visibility = Visibility.Visible;
     button1.Visibility = Visibility.Hidden;
     string code = textBox.Text;
     organism = new Organism.Organism();
     Captain go = new Captain(code, organism);
     
 }
Exemplo n.º 2
0
        private void Paint(Organism.Organism organism)
        {
            string label_text;
            CellConfig work_cells = organism.cell_stats;

            label_text = "Cells:\r";
            label_text += "--------------------------\n";
            label_text += PaintCells(work_cells);
            label_text += "--------------------------\n";
            label_text += "Generators:\r";
            label.Content = label_text;
        }
Exemplo n.º 3
0
 public void exec(CommandEnum command, List<string> attributes, Organism.Organism organism)
 {
     switch (command)
     {
         case CommandEnum.born:
             Born born = new Born(organism);
             born.exec(attributes);
             break;
         default:
             break;
     }
 }
Exemplo n.º 4
0
        public Captain(string new_code, Organism.Organism new_organism)
        {
            code = new_code;
            organism = new_organism;
            Parser parser = new Parser();
            List<string> lines = code.Split(stop_symbol).ToList();

            for (var i=0; i<lines.Count; i++)
            {
                string line = lines[i];

                string after_parse = parser.Parse(line);
                List<string> attributes = after_parse.Split().ToList();
                CommandEnum command = (CommandEnum)Enum.Parse(typeof(CommandEnum), attributes[0]);
                attributes.RemoveAt(0);
                exec(command, attributes, organism);
                
            }


           
        }
Exemplo n.º 5
0
 public Born(Organism.Organism new_organism)
 {
     organism = new_organism;
 }