private void LoadData(List <float[]> X, List <float> Y)
        {
            LearningRangeStart = null;
            LearningRangeEnd   = null;
            if (X.Count == 0)
            {
                DateTime startDate = _settings.GetSettingDateTime("LearnDStart");
                DateTime endDate   = _settings.GetSettingDateTime("LearnDEnd");
                var      rows      = _gs.GetGameInfos(startDate, endDate);
                if (rows.Count == 0)
                {
                    return;
                }

                foreach (var row in rows)
                {
                    row.TrimMoves();
                    if (!row.IsValid())
                    {
                        continue;
                    }
                    if (LearningRangeEnd is null)
                    {
                        LearningRangeEnd = row.Game.Id;
                    }
                    LearningRangeStart = row.Game.Id;

                    int i;
                    Debug.Assert(row.Moves.Count > 0);
                    int machProfit = row.AreLastTwoMovesEqual() ?
                                     row.Game.Surplus - (int)row.Game.TurksProfit :
                                     row.Game.MachineDisValue;
                    Debug.Assert(machProfit >= 0 && machProfit <= 20, $"machProfit is incorrect in row:{row.Game.Id}");
                    i = row.Game.MachineStarts ? 0 : 1;
                    for (; i < row.Moves.Count; i += 2)
                    {
                        var x = row.GetSubHistory(i);
                        X.Add(x);
                        Y.Add(machProfit);
                    }
                }
            }
        }
Esempio n. 2
0
        private string GetContent(FileFormat format)
        {
            var rows = _gs.GetGameInfos();

            if (rows.Count == 0)
            {
                return("Nothing to see here, there were no finished games");
            }
            switch (format)
            {
            case FileFormat.TrainingVectorsNormalized:
                return(TrainingNormalized(rows));

            case FileFormat.TrainingVectors:
                return(TrainingInt(rows));

            default:
                return(GamesMoves(rows));
            }
        }