Compare commits

..

No commits in common. "a99467dfbf7b8d6aca4367b595e7c4448fe25404" and "01187cf8d9f8fae90fe45763df202732d5997a3b" have entirely different histories.

5 changed files with 8 additions and 36 deletions

View File

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

View File

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

View File

@ -64,7 +64,7 @@ type ScoreCallback = (run_round: number, score: number) => boolean;
async function fight(names: string): Promise<FightResult> { async function fight(names: string): Promise<FightResult> {
// 检查一下输入是否合法 // 检查一下输入是否合法
// 比如里面有没有 !test! // 比如里面有没有 !test!
if (names.indexOf("!test!") !== -1) { if (names.startsWith("!test!")) {
throw new Error("你怎么在对战输入里加 !test!(恼)\n${names}"); throw new Error("你怎么在对战输入里加 !test!(恼)\n${names}");
} }
return await md5_module.fight(names); return await md5_module.fight(names);
@ -156,10 +156,8 @@ async function main() {
const path = require("path"); const path = require("path");
const names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8"); const names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8");
// const result = await fight(names); const result = await fight(names);
const result = await md5_module.run_any(names, 50000); console.log(`赢家:|${result.source_plr}|`);
// console.log(`赢家:|${result.source_plr}|`);
console.log(result);
} }
main(); main();

View File

@ -21845,30 +21845,6 @@ 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) { if (run_env.from_code) {

View File

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