Ejemplo n.º 1
0
        private void InsertRawTrainingRecord(Move move, float finalScore)
        {
            var sql     = RLTSettings.GetInsertRecordSQL(move, finalScore); // $"INSERT INTO training_raw (Id, Decision, Score) values ({id}, '{decision}', {score})";
            var command = new SQLiteCommand(sql, Conn);

            command.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
        private void UpdateTrainingDB(T iteration)
        {
            var tr = Conn.BeginTransaction();

            foreach (var m in iteration.Board.MoveHistory)
            {
                var command = Conn.CreateCommand();
                command.CommandText = RLTSettings.GetInsertRecordSQL(m, iteration.Board.Score); // $"INSERT INTO training_raw (Id, Decision, Score) values ({m.StartState.CanonicalFieldID()}, '{m.Direction}', {board.Score})";
                command.ExecuteNonQuery();
            }

            //commit
            try { tr.Commit(); }
            catch (Exception)
            {
                Console.WriteLine("Error writing training data, rolled back");
                tr.Rollback();
            }
            finally { tr.Dispose(); }
        }