diff --git a/branch/latest/md5.js b/branch/latest/md5.js index b1f9a47..84ed45b 100644 --- a/branch/latest/md5.js +++ b/branch/latest/md5.js @@ -12858,6 +12858,14 @@ V.ProfileMain.prototype = { // 实力评估中...[2]% + this.Q // benchmarking = benchmarking + "胜场: " + this_.Q + "胜率: " + (this_.Q / this_.ch) // debug 用, 输出csv格式 + if (run_env.from_code) { + finish_trigger.emit("score_report", this_.ch, this_.Q); + if (stop_bomb) { + stop_bomb = false + async_goto = 1; + break; + } + } // benchmarking = this_.Q + "," + this_.ch + "," + (this_.Q / this_.ch) outer_display.push(T.RunUpdate_init(benchmarking, null, null, C.JsInt.ag(this_.ch, 100), null, 0, 0, 0)) if (this_.ch >= this_.d) { @@ -13122,9 +13130,6 @@ X.ProfileFind.prototype = { o = H.b([], t.Y) e.push($.K()) // 评分输出 - if (run_env.from_code) { - console.log("outputing score") - } if (this_.b >= d.length) { e.push(T.RunUpdate_init(LangData.get_lang("tdaa"), null, null, null, null, 0, 1000, 100)) if (this_.e === 0) { @@ -21802,21 +21807,36 @@ let runner = { }) }, win_rate: (names, target_round) => { - let win_datas = []; return new Promise((resolve, reject) => { + let win_datas = []; finish_trigger.on("win_rate", (run_round, win_count) => { // 先把数据存起来 win_datas.push({round: run_round, win_count: win_count}); // 如果数据长度等于 round,说明数据已经全部返回 if (run_round >= target_round) { stop_bomb = true; - resolve(win_datas); + resolve(win_count, win_datas); } }); main(names); }); }, + score: (names, target_round) => { + return new Promise((resolve, reject) => { + let score_datas = []; + finish_trigger.on("score_report", (run_round, score) => { + // 先把数据存起来 + score_datas.push({round: run_round, score: score}); + // 如果数据长度等于 round,说明数据已经全部返回 + if (run_round >= target_round) { + stop_bomb = true; + resolve(score, score_datas); + }; + }); + main(names); + }); + }, }; if (run_env.from_code) { diff --git a/branch/latest/test.ts b/branch/latest/test.ts index 0d02454..0f238bc 100644 --- a/branch/latest/test.ts +++ b/branch/latest/test.ts @@ -9,6 +9,10 @@ async function main() { let win_rate = await md5_module.win_rate("!test!\n\naaaaaa\n\nbbbbb", 1000); console.log("胜率: ", win_rate); + + let score = await md5_module.score("!test!\n\naaaaaabbbb", 1000); + + console.log("分数: ", score); }; main();