Util
Wordle_bot Index / src
/ Cli / Util
Auto-generated documentation for src.cli.util module.
get_bot_selection
Get the desired bot of many implementations from the user.
Parameters
bots : list[BotBehaviors] A list of bots available
Returns
int The index of the bot selected
Signature
def get_bot_selection(bots: list[type[BotBehaviors]]) -> int: ...
get_choice_from_prompt
Prompt the user with a question and a list of options, returning their choice.
Additionally provides some input checking to ensure the selection is valid.
Parameters
prompt : str The prompt message, which should be descriptive. options : list[str] A list of strings that correspond with the selections available. The first element is always the default, which is accepted if the user immediately presses the return key. has_default : bool, optional Whether the first option should be accepted by default, defaults to True
Returns
int The choice, 0-indexed
Raises
ValueError Only when the user provides an illegal option
Signature
def get_choice_from_prompt(prompt: str, options: list[str], has_default=True) -> int: ...