示例#1
0
 public void GetReportIntermediateBestMovesValue(out string type, out string value, out string values)
 {
     type   = "bool";
     value  = ReportIntermediateBestMoves.ToString();
     values = "";
 }
示例#2
0
        public void SaveGameAIConfig(XmlWriter writer, string rootName, ConfigSaveType configSaveType)
        {
            if (null == writer)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            if (string.IsNullOrWhiteSpace(rootName))
            {
                throw new ArgumentNullException(nameof(rootName));
            }

            writer.WriteStartElement(rootName);

            if (configSaveType.HasFlag(ConfigSaveType.BasicOptions))
            {
                if (TranspositionTableSizeMB.HasValue)
                {
                    writer.WriteElementString("TranspositionTableSizeMB", TranspositionTableSizeMB.Value.ToString());
                }

                if (!_maxHelperThreads.HasValue)
                {
                    writer.WriteElementString("MaxHelperThreads", "Auto");
                }
                else if (_maxHelperThreads.Value == 0)
                {
                    writer.WriteElementString("MaxHelperThreads", "None");
                }
                else
                {
                    writer.WriteElementString("MaxHelperThreads", _maxHelperThreads.Value.ToString());
                }

                writer.WriteElementString("PonderDuringIdle", PonderDuringIdle.ToString());

                if (MaxBranchingFactor.HasValue)
                {
                    writer.WriteElementString("MaxBranchingFactor", MaxBranchingFactor.Value.ToString());
                }

                writer.WriteElementString("ReportIntermediateBestMoves", ReportIntermediateBestMoves.ToString());
            }

            if (configSaveType.HasFlag(ConfigSaveType.MetricWeights))
            {
                foreach (KeyValuePair <ExpansionPieces, MetricWeights[]> kvp in MetricWeightSet)
                {
                    ExpansionPieces gameType = kvp.Key;
                    MetricWeights[] mw       = kvp.Value;

                    if (null != mw[0] && null != mw[1])
                    {
                        mw[0].WriteMetricWeightsXml(writer, "StartMetricWeights", gameType);
                        mw[1].WriteMetricWeightsXml(writer, "EndMetricWeights", gameType);
                    }
                    else if (null != mw[0] && null == mw[1])
                    {
                        mw[0].WriteMetricWeightsXml(writer, gameType: gameType);
                    }
                }
            }

            if (configSaveType.HasFlag(ConfigSaveType.InitialTranspositionTable))
            {
                foreach (KeyValuePair <ExpansionPieces, TranspositionTable> kvp in InitialTranspositionTables)
                {
                    ExpansionPieces    gameType = kvp.Key;
                    TranspositionTable tt       = kvp.Value;

                    tt?.WriteTranspositionTableXml(writer, "InitialTranspositionTable", gameType);
                }
            }

            writer.WriteEndElement();
        }