예제 #1
0
        /// <summary>
        /// Update the SearchMode object
        /// </summary>
        public void UpdateSearchMode()
        {
            Properties.Settings settings = Properties.Settings.Default;
            int iTransTableSize;
            IBoardEvaluation boardEval;

            settings.UseAlphaBeta         = radioButtonAlphaBeta.IsChecked.Value;
            settings.UseBook              = checkBoxBookOpening.IsChecked.Value;
            settings.UseTransTable        = checkBoxTransTable.IsChecked.Value;
            settings.PlyCount             = (int)plyCount.Value;
            settings.AverageTime          = Int32.Parse(textBoxTimeInSec.Text);
            settings.UsePlyCount          = radioButtonFixDepth.IsChecked.Value;
            settings.UsePlyCountIterative = radioButtonFixDepthIterative.IsChecked.Value;
            m_searchMode.m_eOption        = (radioButtonAlphaBeta.IsChecked == true) ? SearchEngine.SearchMode.OptionE.UseAlphaBeta :
                                            SearchEngine.SearchMode.OptionE.UseMinMax;
            if (checkBoxBookOpening.IsChecked == true)
            {
                m_searchMode.m_eOption |= SearchEngine.SearchMode.OptionE.UseBook;
            }
            if (checkBoxTransTable.IsChecked == true)
            {
                m_searchMode.m_eOption |= SearchEngine.SearchMode.OptionE.UseTransTable;
            }
            if (radioButtonOnePerProc.IsChecked == true)
            {
                m_searchMode.m_eThreadingMode = SearchEngine.SearchMode.ThreadingModeE.OnePerProcessorForSearch;
                settings.UseThread            = 2;
            }
            else if (radioButtonOneForUI.IsChecked == true)
            {
                m_searchMode.m_eThreadingMode = SearchEngine.SearchMode.ThreadingModeE.DifferentThreadForSearch;
                settings.UseThread            = 1;
            }
            else
            {
                m_searchMode.m_eThreadingMode = SearchEngine.SearchMode.ThreadingModeE.Off;
                settings.UseThread            = 0;
            }
            if (radioButtonAvgTime.IsChecked == true)
            {
                m_searchMode.m_iSearchDepth  = 0;
                m_searchMode.m_iTimeOutInSec = Int32.Parse(textBoxTimeInSec.Text);
            }
            else
            {
                m_searchMode.m_iSearchDepth  = (int)plyCount.Value;
                m_searchMode.m_iTimeOutInSec = 0;
                if (radioButtonFixDepthIterative.IsChecked == true)
                {
                    m_searchMode.m_eOption |= SearchEngine.SearchMode.OptionE.UseIterativeDepthSearch;
                }
            }
            if (radioButtonRndOff.IsChecked == true)
            {
                m_searchMode.m_eRandomMode = SearchEngine.SearchMode.RandomModeE.Off;
            }
            else if (radioButtonRndOnRep.IsChecked == true)
            {
                m_searchMode.m_eRandomMode = SearchEngine.SearchMode.RandomModeE.OnRepetitive;
            }
            else
            {
                m_searchMode.m_eRandomMode = SearchEngine.SearchMode.RandomModeE.On;
            }
            settings.RandomMode             = (int)m_searchMode.m_eRandomMode;
            iTransTableSize                 = Int32.Parse(textBoxTransSize.Text);
            settings.TransTableSize         = iTransTableSize;
            TransTable.TranslationTableSize = iTransTableSize / 32 * 1000000;

            boardEval = m_boardEvalUtil.FindBoardEvaluator(comboBoxWhiteBEval.SelectedItem.ToString());
            if (boardEval == null)
            {
                boardEval = m_boardEvalUtil.BoardEvaluators[0];
            }
            m_searchMode.m_boardEvaluationWhite = boardEval;
            settings.WhiteBoardEval             = boardEval.Name;
            boardEval = m_boardEvalUtil.FindBoardEvaluator(comboBoxBlackBEval.SelectedItem.ToString());
            if (boardEval == null)
            {
                boardEval = m_boardEvalUtil.BoardEvaluators[0];
            }
            m_searchMode.m_boardEvaluationBlack = boardEval;
            settings.BlackBoardEval             = boardEval.Name;
            settings.Save();
        }
예제 #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="settings"> Properties setting</param>
 public SettingAdaptor(Properties.Settings settings)
 {
     m_settings = settings;
 }