fixes and cleanup
This commit is contained in:
parent
374c42802e
commit
bc211621e5
6 changed files with 199 additions and 83 deletions
|
@ -15,6 +15,7 @@ import {
|
|||
} from "./lib/lib.ts";
|
||||
|
||||
import { francais } from "../data/data.ts";
|
||||
import { last } from "./lib/utils.ts";
|
||||
|
||||
async function main() {
|
||||
const args = await new Command().name("simulation")
|
||||
|
@ -27,6 +28,9 @@ async function main() {
|
|||
).option(
|
||||
"-n, --length <length:number>",
|
||||
"Length of the word to use from the dictionnary.",
|
||||
).option(
|
||||
"-m, --max <max:number>",
|
||||
"Maximum number of iterations.",
|
||||
).option(
|
||||
"-w, --wait <wait:number>",
|
||||
"Time to wait between guesses, in ms.",
|
||||
|
@ -56,8 +60,10 @@ async function main() {
|
|||
console.log("Target is", game.word);
|
||||
console.log();
|
||||
|
||||
const runner = new Runner(game, guesser, new TableLogging(), args.options.wait);
|
||||
await runner.play_all();
|
||||
const runner = new Runner(game, guesser, new TableLogging(), args.options.wait, args.options.max);
|
||||
const result = last(await runner.play_all());
|
||||
if (result === undefined) Deno.exit(1);
|
||||
if (result.result.kind === "failure") Deno.exit(1);
|
||||
}
|
||||
|
||||
function validate_target(target: string, length: number) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue