public string searchForResult(string valueStr, int valueInt) // value = currentBomb
        {
            typeOfBomb    = valueInt;
            typeOfBombBin = valueStr;

            bool              alreadyFound     = false;
            Genetic           processAlgorithm = new Genetic();
            List <Individual> parentalPopulation;

            parentalPopulation = processAlgorithm.Initialization();
            parentalPopulation = processAlgorithm.FitnessFunction(parentalPopulation);

            do
            {
                // !!! WARUNEK STOPU
                alreadyFound = processAlgorithm.checkCondition(parentalPopulation);

                if (alreadyFound == false)
                {
                    List <Individual> posterityPopulation = new List <Individual>();
                    posterityPopulation = processAlgorithm.Selection(parentalPopulation, posterityPopulation);

                    List <Individual> crossoverdPopulation = new List <Individual>();
                    crossoverdPopulation = processAlgorithm.Crossover(posterityPopulation);
                    crossoverdPopulation = processAlgorithm.Mutation(crossoverdPopulation);
                    crossoverdPopulation = processAlgorithm.FitnessFunction(crossoverdPopulation);

                    parentalPopulation.Clear();
                    parentalPopulation = crossoverdPopulation;
                }
            }while (alreadyFound == false);

            string resultOfAlg = "";

            resultOfAlg = processAlgorithm.bestChromosome(parentalPopulation);

            //Console.WriteLine("WYNIK = {0} ", resultOfAlg);
            return(resultOfAlg);
        }
        public async Task <Tuple <Disarming, Disarming, Disarming> > GetDisarmingProcedure(int beepsLevel)
        {
            await   _learnGenTask;
            Genetic findResultForBomb = new Genetic();
            bool    foundResult       = false;
            string  currentBomb       = "";
            var     result            = new Disarming[3];

            switch (beepsLevel)
            {
            case 1: currentBomb = "10000"; break;

            case 2: currentBomb = "01000"; break;

            case 3: currentBomb = "00100"; break;

            case 4: currentBomb = "00010"; break;

            case 5: currentBomb = "00001"; break;

            default: currentBomb = "00000"; break;
            }

            //Console.WriteLine("Wkładam = {0}, {1}", currentBomb, beepsLevel);
            string resultOfFunction = findResultForBomb.searchForResult(currentBomb, beepsLevel);

            if (resultOfFunction == currentBomb)
            {
                foundResult = true;
            }

            if (foundResult == true)
            {
                switch (resultOfFunction)
                {
                case "10000":         //Ball
                    result[0] = Disarming.CutControlWire;
                    result[1] = Disarming.CutYellowWire;
                    result[2] = Disarming.CutRedWire;
                    break;

                case "01000":         //DemolitionBomb
                    result[0] = Disarming.CutBlueWire;
                    result[1] = Disarming.CutGreenWire;
                    result[2] = Disarming.CutRedWire;
                    break;

                case "00100":         //DemolitionExplosiveBomb
                    result[0] = Disarming.CutGreenWire;
                    result[1] = Disarming.CutControlWire;
                    result[2] = Disarming.CutYellowWire;
                    break;

                case "00010":         //ExplosiveBomb
                    result[0] = Disarming.CutRedWire;
                    result[1] = Disarming.CutGreenWire;
                    result[2] = Disarming.CutBlueWire;
                    break;

                case "00001":         //Mine
                    result[0] = Disarming.CutRedWire;
                    result[1] = Disarming.CutGreenWire;
                    result[2] = Disarming.CutBlueWire;
                    break;
                }
            }

            return(Tuple.Create(result[0], result[1], result[2]));
        }