codenames / my_guesser.py
nathanael-fijalkow's picture
Exposes number of guesses for the guesser
e268213
raw
history blame contribute delete
543 Bytes
from __future__ import annotations
from typing import Optional
from codenames.embedder import EmbeddingIndex
from codenames.dictionary import load_dictionary
_dictionary = load_dictionary()
_index = EmbeddingIndex(_dictionary)
def guesser(clue: str, board_state: list[str], number: int) -> Optional[str]:
"""
Given a clue word, list of unrevealed board words, and the spymaster's
number, return a word to guess, or None to stop guessing.
You can make up to (number + 1) guesses per round.
"""
return board_state[0]