Exemplo n.º 1
0
        public void LoadGameAIConfig(XmlReader reader)
        {
            if (null == reader)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    ExpansionPieces expansionPieces = EnumUtils.ParseExpansionPieces(reader["GameType"]);

                    switch (reader.Name)
                    {
                    case "TranspositionTableSizeMB":
                        ParseTranspositionTableSizeMBValue(reader.ReadElementContentAsString());
                        break;

                    case "MaxHelperThreads":
                        ParseMaxHelperThreadsValue(reader.ReadElementContentAsString());
                        break;

                    case "PonderDuringIdle":
                        ParsePonderDuringIdleValue(reader.ReadElementContentAsString());
                        break;

                    case "MaxBranchingFactor":
                        ParseMaxBranchingFactorValue(reader.ReadElementContentAsString());
                        break;

                    case "ReportIntermediateBestMoves":
                        ParseReportIntermediateBestMovesValue(reader.ReadElementContentAsString());
                        break;

                    case "MetricWeights":
                        SetStartMetricWeights(expansionPieces, MetricWeights.ReadMetricWeightsXml(reader.ReadSubtree()));
                        SetEndMetricWeights(expansionPieces, MetricWeights.ReadMetricWeightsXml(reader.ReadSubtree()));
                        break;

                    case "StartMetricWeights":
                        SetStartMetricWeights(expansionPieces, MetricWeights.ReadMetricWeightsXml(reader.ReadSubtree()));
                        break;

                    case "EndMetricWeights":
                        SetEndMetricWeights(expansionPieces, MetricWeights.ReadMetricWeightsXml(reader.ReadSubtree()));
                        break;

                    case "InitialTranspositionTable":
                        SetInitialTranspositionTable(expansionPieces, TranspositionTable.ReadTranspositionTableXml(reader.ReadSubtree()));
                        break;
                    }
                }
            }
        }