refactor, rename explorer guesser

This commit is contained in:
JOLIMAITRE Matthieu 2024-05-02 16:29:08 +02:00
parent 9d36edecc9
commit f0b1200e6f
4 changed files with 6 additions and 6 deletions

View file

@ -12,7 +12,7 @@ type Knowledge = {
not_at: Set<number>; not_at: Set<number>;
}; };
export class BaseGuesser implements Guessing { export class ExplorerGuesser implements Guessing {
length; length;
dict; dict;
informations; informations;

View file

@ -1,6 +1,6 @@
export { Dict } from "./dict.ts"; export { Dict } from "./dict.ts";
export type { Guessing } from "./guesser/guesser.ts"; export type { Guessing } from "./guesser/guesser.ts";
export { BaseGuesser } from "./guesser/base.ts"; export { ExplorerGuesser } from "./guesser/explorer.ts";
export { ReducingGuesser } from "./guesser/reducing.ts"; export { ReducingGuesser } from "./guesser/reducing.ts";
export { Simulator } from "./game/simulator.ts"; export { Simulator } from "./game/simulator.ts";
export { ManualProxy } from "./game/proxy.ts"; export { ManualProxy } from "./game/proxy.ts";

View file

@ -2,7 +2,7 @@
import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts"; import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts";
import { BaseGuesser, Dict, ManualProxy, Runner } from "./lib/lib.ts"; import { Dict, ExplorerGuesser, ManualProxy, Runner } from "./lib/lib.ts";
import { initialize_prompt } from "./lib/prompt.ts"; import { initialize_prompt } from "./lib/prompt.ts";
import { VerboseLogging } from "./lib/runner.ts"; import { VerboseLogging } from "./lib/runner.ts";
@ -24,7 +24,7 @@ async function main() {
if (args.options.file !== undefined) dict = await Dict.from_text_file(args.options.file, init.length); if (args.options.file !== undefined) dict = await Dict.from_text_file(args.options.file, init.length);
for (const [index, letter] of init.constraints) dict.constraint(index, letter); for (const [index, letter] of init.constraints) dict.constraint(index, letter);
const guesser = new BaseGuesser(dict); const guesser = new ExplorerGuesser(dict);
const game = new ManualProxy(init.length); const game = new ManualProxy(init.length);
const runner = new Runner(game, guesser, new VerboseLogging()); const runner = new Runner(game, guesser, new VerboseLogging());

View file

@ -3,8 +3,8 @@
import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts"; import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts";
import { import {
BaseGuesser,
Dict, Dict,
ExplorerGuesser,
Guessing, Guessing,
LoggingStrategy, LoggingStrategy,
ReducingGuesser, ReducingGuesser,
@ -66,7 +66,7 @@ function validate_target(target: string, length: number) {
} }
const guessers = new Map<string, (dict: Dict) => Guessing>([ const guessers = new Map<string, (dict: Dict) => Guessing>([
["explorer", (dict: Dict) => new BaseGuesser(dict)], ["explorer", (dict: Dict) => new ExplorerGuesser(dict)],
["reducing", (dict: Dict) => new ReducingGuesser(dict)], ["reducing", (dict: Dict) => new ReducingGuesser(dict)],
]); ]);