import { assertNotEquals } from "https://deno.land/std@0.224.0/assert/assert_not_equals.ts";

import { GuessResult } from "../game/game.ts";
import { Awaitable } from "../utils.ts";

export interface Guessing {
	declare_properties(): string[];
	guess(try_: (guess: string, ...properties: unknown[]) => Awaitable<GuessResult>): Promise<GuessResult | null>;
}

export function pick_random_common_word(bests: string[]) {
	assertNotEquals(bests.length, 0);
	const index = Math.floor(Math.random() * bests.length);
	return bests[index];
}
