void StartButtonClick(object sender, EventArgs e)
        {
            if (!Settings.CanStartWithKnownLayout)
                return;

            var algorithm = new KeyboardEPAlgorithm(Settings.CurrentCorpus.FromJust, mainControl.settings.CurrentTimes.FromJust.Times,
                mainControl.Logger);
            var layout = Settings.CurrentLayout.FromJust;
            algorithm.SetLayout(layout);

            ConsoleTextBox.AppendText(startingNew);
            ConsoleTextBox.AppendText(MainControl.PrintLayoutWithScore(layout, algorithm.CurrentScore));

            mainControl.Start(algorithm);
        }
        KeyboardEPAlgorithm GetTestAlgorithm()
        {
            const int width = 3;
            const int height = 3;
            const int keyboardKeyCount = width * height;
            var keyboard = new Keyboard(Enumerable.Range(0, height).Select(_ => width).ToArray(),
                Keyboard.StandardKeyboard.AllChars.Take(keyboardKeyCount).ToHashSet());
            var timeBuilder = TransitionTimeBuilder.GetEmpty(keyboard);
            var fractions = new double[keyboardKeyCount, keyboardKeyCount];
            for (var i = 0; i < keyboardKeyCount; i++)
            {
                for (var j = i; j < keyboardKeyCount; j++)
                {
                    var miliseconds = i + j * keyboardKeyCount;
                    timeBuilder[i, j].AddMeasurement(miliseconds);
                    fractions[i, j] = miliseconds;
                }
            }

            var corpus = new Corpus(fractions, keyboardKeyCount, keyboard);
            var algorithm = new KeyboardEPAlgorithm(corpus, timeBuilder.Times, GetLogger());
            algorithm.SetLayout(KeyboardLayout.Random(keyboard));
            return algorithm;
        }
 KeyboardEPAlgorithm GetStandardWithCurrentSettings()
 {
     var corpus = Settings.CurrentCorpus.FromJust;
     var style = Settings.CurrentTimes.FromJust.Times;
     var algorithm = new KeyboardEPAlgorithm(corpus, style, GetLogger());
     algorithm.SetLayout(KeyboardLayout.Random(Keyboard.StandardKeyboard));
     return algorithm;
 }
        void StartRandomButtonClick(object sender, EventArgs e)
        {
            if (Settings.CanStart)
            {
                mainControl.consoleTextBox.Clear();
                var layout = KeyboardLayout.Random(Keyboard.StandardKeyboard);
                ConsoleTextBox.AppendText("Starting algorithm with a random layout." + Environment.NewLine);
                var algorithm = new KeyboardEPAlgorithm(Settings.CurrentCorpus.FromJust, Settings.CurrentTimes.FromJust.Times,
                    mainControl.Logger);
                algorithm.SetLayout(layout);

                ConsoleTextBox.AppendText(startingNew);
                ConsoleTextBox.AppendText(MainControl.PrintLayoutWithScore(layout, algorithm.CurrentScore));

                mainControl.Start(algorithm);
            }
            else
                ConsoleTextBox.AppendText(inComplete);
        }