コード例 #1
0
 private void Reset()
 {
     GameNotation   = new List <string>();
     EvaluatedMoves = new Dictionary <int, KeyValuePair <int, MoveValue> >();
     EvaluatingMove = new MoveValue();
     WhitePlayedEngineLinePercentage = new string[GameNumber, evaluatedLines];
     BlackPlayedEngineLinePercentage = new string[GameNumber, evaluatedLines];
     player = Player.white;
 }
コード例 #2
0
        public void AnalyzeEngineLinePercentage()
        {
            reader = LoadFile(fileName);
            int counter    = 1;
            int subCounter = 1;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "move")
                    {
                        GetPlayerColor();
                    }

                    else if (reader.Name == "evaluation")
                    {
                        EvaluatingMove = GetEvaluationMove();
                    }

                    else if (reader.Name == "played")
                    {
                        GameNotation?.Add(GetPlayedMove());
                        subCounter = 1;
                    }

                    else if (reader.Name == "tag")
                    {
                        FillGameData();
                    }
                }

                else if (reader.Name == "game" && reader.NodeType == XmlNodeType.EndElement)
                {
                    currentGameNumber++;
                    for (int i = 0; i < evaluatedLines; i++)
                    {
                        WhitePlayedEngineLinePercentage[currentGameNumber, i] = CalculatePercentage(i + 1, Player.white).ToString("P1");
                        BlackPlayedEngineLinePercentage[currentGameNumber, i] = CalculatePercentage(i + 1, Player.black).ToString("P1");
                    }
                }

                if (EvaluatingMove != new MoveValue())
                {
                    EvaluatedMoves.Add(counter, new KeyValuePair <int, MoveValue>(subCounter, EvaluatingMove));
                    counter++;
                    subCounter++;
                }
                EvaluatingMove = new MoveValue();
            }
        }