SampleApp.MainForm.startLearningButton_Click C# (CSharp) Method

startLearningButton_Click() private method

private startLearningButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void startLearningButton_Click( object sender, EventArgs e )
        {
            // get settings
            GetSettings( );
            ShowSettings( );

            iterationBox.Text = string.Empty;

            // destroy algorithms
            qLearning = null;
            sarsa = null;

            if ( algorithmCombo.SelectedIndex == 0 )
            {
                // create new QLearning algorithm's instance
                qLearning = new QLearning( 256, 4, new TabuSearchExploration( 4, new EpsilonGreedyExploration( explorationRate ) ) );
                workerThread = new Thread( new ThreadStart( QLearningThread ) );
            }
            else
            {
                // create new Sarsa algorithm's instance
                sarsa = new Sarsa( 256, 4, new TabuSearchExploration( 4, new EpsilonGreedyExploration( explorationRate ) ) );
                workerThread = new Thread( new ThreadStart( SarsaThread ) );
            }

            // disable all settings controls except "Stop" button
            EnableControls( false );

            // run worker thread
            needToStop = false;
            workerThread.Start( );
        }
MainForm