static void Main(string[] args)
 {
     int automataID = GetAutomataID();
     int iterationCount = GetIterationCount();
     turmiteMatrix = new TurmiteMatrix(MATRIX_RANGE);
     crystalMatrix = new CrystalMapping(MATRIX_RANGE);
     if (automataID >= 0 && automataID <= 4)
     {
         switch (automataID)
         {
             case 0: crystal = new Crystal(crystalMatrix, 286); break;
             case 1: crystal = new Crystal(crystalMatrix, 324); break;
             case 2: crystal = new Crystal(crystalMatrix, 465); break;
             case 3: crystal = new Crystal(crystalMatrix, 501); break;
             case 4: crystal = new Crystal(crystalMatrix, 471); break;
         }
         IterateAutomata(crystal.GrowToNextIteration, iterationCount);
         SaveMatrixAsImage(crystalMatrix);
     }
     else
     {
         string ruleDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Rules\");
         TurmitRule turmiteRule = new TurmitRule();
         switch (automataID)
         {
             case 5: turmiteRule.ReadRuleFromFile(Path.Combine(ruleDir, @"Labirint.txt")); break;
             case 6: turmiteRule.ReadRuleFromFile(Path.Combine(ruleDir, @"Island.txt")); break;
             case 7: turmiteRule.ReadRuleFromFile(Path.Combine(ruleDir, @"Cross.txt")); break;
             default: turmiteRule.ReadRuleFromFile(Path.Combine(ruleDir, @"YellowSquare.txt")); break;
         }
         turmite = new Turmit(turmiteRule, turmiteMatrix);
         IterateAutomata(turmite.Move, iterationCount);
         SaveMatrixAsImage(turmiteMatrix);
     }
     Console.ReadLine();
 }
 private void automataName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (automataType.SelectedIndex == 0)
     {
         int ruleNumber;
         switch (automataName.SelectedIndex)
         {
             case 0: ruleNumber = 286; break;
             case 1: ruleNumber = 324; break;
             case 2: ruleNumber = 465; break;
             case 3: ruleNumber = 501; break;
             default: ruleNumber = 471; break;
         }
         crystalMatrix.Reset();
         crystal = new Crystal(crystalMatrix, ruleNumber);
     }
     else
     {
         string currentDir = Directory.GetCurrentDirectory();
         try
         {
             switch (automataName.SelectedIndex)
             {
                 case 0: turmiteRule.ReadRuleFromFile(Path.Combine(currentDir, @"Rules/Labirint.txt")); break;
                 case 1: turmiteRule.ReadRuleFromFile(Path.Combine(currentDir, @"Rules/Island.txt")); break;
                 case 2: turmiteRule.ReadRuleFromFile(Path.Combine(currentDir, @"Rules/Cross.txt")); break;
                 case 3: turmiteRule.ReadRuleFromFile(Path.Combine(currentDir, @"Rules/YellowSquare.txt")); break;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка времени исполнения", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         turmiteMatrix.ResetMatrix();
         turmit = new Turmit(turmiteRule, turmiteMatrix);
     }
 }