<commit_before>var fileName = process.cwd() + '/game.db';
var path = require('fs');
var db_Flag = path.existsSync(fileName);
var sqlite3 = require('sqlite3').verbose();

var db = new sqlite3.Database(fileName);
console.log("run: "+db_Flag);



//データベースがあるかどうかを確認
var init = function(){

    //DBファイルがあるかどうか
    if(!db_Flag){

        //なければ初期データを作成
        db.serialize(function(){
            db.run("CREATE TABLE game_info (name TEXT, value TEXT)");
            db.run("INSERT INTO game_info VALUES ('level', '1')");
        });

    }
};


/*
    現在のレベルを取得
*/
exports.getLevel = function(){
    return co(function* (){
        res = yield get('level');
        return res;
    });
};

var get = function(name){
    return new Promise(function(resolve) {
        var res = db.get("SELECT value FROM game_info WHERE name = '"+ name +"'", [], function(err, res){
            resolve(res.value);
        });
    });
};
init();<commit_msg>経験値を追加<commit_after>var fileName = process.cwd() + '/game.db';
var path = require('fs');
var db_Flag = path.existsSync(fileName);
var sqlite3 = require('sqlite3').verbose();

var db = new sqlite3.Database(fileName);
console.log("run: "+db_Flag);



//データベースがあるかどうかを確認
var init = function(){

    //DBファイルがあるかどうか
    if(!db_Flag){

        //なければ初期データを作成
        db.serialize(function(){
            db.run("CREATE TABLE game_info (name TEXT, value TEXT)");
            db.run("INSERT INTO game_info VALUES ('level', '1')");
            db.run("INSERT INTO game_info VALUES ('experience', '0')");
        });

    }
};


/*
    現在のレベルを取得
*/
exports.getLevel = function(){
    return co(function* (){
        res = yield get('level');
        return res;
    });
};

var get = function(name){
    return new Promise(function(resolve) {
        var res = db.get("SELECT value FROM game_info WHERE name = '"+ name +"'", [], function(err, res){
            resolve(res.value);
        });
    });
};
init();
{'fraction_non_alphanumeric': 0.1738009283135637, 'fraction_numerical': 0.0046415678184631255, 'mean_word_length': 2.730769230769231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5128509', 'n_tokens_mistral': 690, 'n_tokens_neox': 679, 'n_words': 143}