更新ruaa

This commit is contained in:
shenjack 2024-05-10 19:03:03 +08:00
parent 6fc85322cd
commit a99467dfbf
Signed by: shenjack
GPG Key ID: 7B1134A979775551
5 changed files with 35 additions and 7 deletions

View File

@ -1,3 +1,4 @@
input.txt
node_modules
package.json
package.json
package-lock.json

View File

@ -47,7 +47,7 @@ function fight(names) {
case 0:
// 检查一下输入是否合法
// 比如里面有没有 !test!
if (names.startsWith("!test!")) {
if (names.indexOf("!test!") !== -1) {
throw new Error("你怎么在对战输入里加 !test!(恼)\n${names}");
}
return [4 /*yield*/, md5_module.fight(names)];
@ -164,10 +164,11 @@ function main() {
fs = require("fs");
path = require("path");
names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8");
return [4 /*yield*/, fight(names)];
return [4 /*yield*/, md5_module.run_any(names, 50000)];
case 1:
result = _a.sent();
console.log("\u8D62\u5BB6:|".concat(result.source_plr, "|"));
// console.log(`赢家:|${result.source_plr}|`);
console.log(result);
return [2 /*return*/];
}
});

View File

@ -156,8 +156,10 @@ async function main() {
const path = require("path");
const names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8");
const result = await fight(names);
console.log(`赢家:|${result.source_plr}|`);
// const result = await fight(names);
const result = await md5_module.run_any(names, 50000);
// console.log(`赢家:|${result.source_plr}|`);
console.log(result);
}
main();

View File

@ -21845,6 +21845,30 @@ const runner = {
});
});
},
run_any: (names, round) => {
return new Promise((resolve, reject) => {
let data = [];
// 三种情况都带上
finish_trigger.on("done_fight", (data) => {
resolve(fmt_RunUpdate(data));
});
finish_trigger.on("win_rate", (run_round, win_count) => {
data.push({ round: run_round, win_count: win_count });
if (run_round >= round) {
stop_bomb = true;
resolve({ score: win_count, raw_data: data });
}
});
finish_trigger.on("score_report", (run_round, score) => {
data.push({ round: run_round, score: score });
if (run_round >= round) {
stop_bomb = true;
resolve({ score: score, raw_data: data });
}
});
main(names);
})
}
};
if (run_env.from_code) {

View File

@ -15,7 +15,7 @@ else:
IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient")
_version_ = "0.3.0"
_version_ = "0.4.0"
COMMAND = "/namerena"