public bool SetConfigOption( CommandBase.CommandData commandData )
    {
        bool bRet = false;
        if( commandData.StrCmd == "id" ) {

            CommandBase.CommandData subCmdData = commandData.QueueSubCmdData.Peek();
            if( subCmdData != null && subCmdData.StrCmd == "name" ) {
                Name = subCmdData.QueueStrValue.Peek();
                bRet = true;
            }
            else if( subCmdData != null && subCmdData.StrCmd == "author" ) {
                Authur = subCmdData.QueueStrValue.Peek();
                bRet = true;
            }
        }
        else if( commandData.StrCmd == "option" ) {

            ChessEngineOption option = new ChessEngineOption();

            foreach( CommandBase.CommandData subCmdData in commandData.QueueSubCmdData ) {

                if( subCmdData != null ) {

                    if( subCmdData.StrCmd == "name" ) {

                        option.Name = subCmdData.QueueStrValue.Peek();
                    }
                    else if( subCmdData.StrCmd == "type" ) {

                        option.Type = subCmdData.QueueStrValue.Peek();
                    }
                    else if( subCmdData.StrCmd == "default" ) {

                         option.Default = subCmdData.QueueStrValue.Peek();
                    }
                    else if( subCmdData.StrCmd == "min" ) {

                         option.Min = subCmdData.QueueStrValue.Peek();
                    }
                    else if( subCmdData.StrCmd == "max" ) {

                         option.Max = subCmdData.QueueStrValue.Peek();
                    }
                    else if( subCmdData.StrCmd == "var" ) {

                        foreach( string strCurrVar in subCmdData.QueueStrValue )
                            option.queueVar.Enqueue( strCurrVar );
                    }
                }
            }

            AddOption( option );
            bRet = true;
        }

        return bRet;
    }
 public void ClearAllOption( ChessEngineOption option )
 {
     mapOption.Clear();
 }
 public void AddOption( ChessEngineOption option )
 {
     mapOption[option.Name] = option;
 }
    public void CopyFrom( ChessEngineOption option )
    {
        this.Name = option.Name;
        this.Type = option.Type;
        this.Default = option.Default;
        this.Min = option.Min;
        this.Max = option.Max;

        foreach( string strValue in option.queueVar ) {

            this.queueVar.Enqueue( strValue );
        }
    }
    public void SetOption( ChessEngineOption option )
    {
        // for stockfish chess engine
        switch( option.Name ) {

        case "Use Debug Log":

            debugLogCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "Use Search Log":

            searchLogCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "Search Log Filename":

            searchLogFileInput.text = option.GetStringDefault();

            break;

        case "Book File":

            bookFileInput.text = option.GetStringDefault();

            break;

        case "Best Book Move":

            bestBookMoveCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "Mobility (Middle Game)":

            mobilityMiddleSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Mobility (Endgame)":

            mobilityEndSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Passed Pawns (Middle Game)":

            passedPawnMiddleSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Passed Pawns (Endgame)":

            passedPawnEndSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Space":

            spaceSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Aggressiveness":

            aggressiveSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Cowardice":

            cowardiceSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Min Split Depth":

            minSplitDepthSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Max Threads per Split Point":

            MTSPSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Threads":

            threadSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Use Sleeping Threads":

            useSleepingThreadCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "Hash":

            hashSizeSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Ponder":

            ponderCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "OwnBook":

            ownBookCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "MultiPV":

            multiPVSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Skill Level":

            skillLevelSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Emergency Move Horizon":

            EMHSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Emergency Base Time":

            EBTSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Emergency Move Time":

            EMTSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Minimum Thinking Time":

            MTTSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "Slow Mover":

            slowMoveSlider.sliderValue = option.GetRangeFloatDefault();

            break;

        case "UCI_Chess960":

            chess960Checkbox.isChecked = option.GetBoolDefault();

            break;

        case "UCI_AnalyseMode":

            analyseModeCheckbox.isChecked = option.GetBoolDefault();

            break;

        case "Clear Hash":

            clearHashCheckbox.isChecked = option.GetBoolDefault();

            break;

        default:
            break;
        }
    }
    public void SetCurrentStringOption( string strOptionName, string strValue )
    {
        if( DefaultConfigData == null || DefaultConfigData.IsEmpty() ) {
            //UnityEngine.Debug.Log( "ChessEngineManager::SetCurrentStringOption() - " + strOptionName );
            return;
        }

        ChessEngineOption defaultOption = DefaultConfigData.GetConfigOption( strOptionName );
        ChessEngineOption currentOption = new ChessEngineOption();
        currentOption.CopyFrom( defaultOption );
        currentOption.SetStringValue( strValue );
        CurrentConfigData.AddOption( currentOption );
    }