"""PA2 Hot Letters.

A guess at a secret word is scored one letter at a time, as in Wordle, and
each letter is wrapped in brackets that show its color without needing to see
the color. A letter in the right spot is green, or on fire: {s}. A letter
that is in the answer but somewhere else is yellow, or warm: [s]. A letter
that is not in the answer is gray, or ice cold: (s). A letter that repeats in
the guess turns yellow only as many times as the answer still has it to spare.

Name: YOUR NAME
Date: THE DATE
"""


def leftovers(guess: str, answer: str) -> dict[str, int]:
    """Count the letters of the answer that the guess did not get exactly right.

    Args:
        guess: The word guessed, in lowercase letters.
        answer: The secret word, in lowercase letters, the same length as
            the guess.

    Returns:
        A new dictionary that maps each letter of the answer to the number of
        times it appears in a spot where the guess has a different letter.
        Letters the guess got right (green) are not counted. Ex:
        leftovers("sheep", "geese") returns {"g": 1, "e": 2, "s": 1}, since
        the middle e of geese is green, and leftovers("speed", "speed")
        returns {}.
    """
    pass


def score(guess: str, answer: str) -> str:
    """Score a guess, the way the game colors its tiles.

    Args:
        guess: The word guessed, in lowercase letters.
        answer: The secret word, in lowercase letters, the same length as
            the guess.

    Returns:
        The letters of the guess, in order, each wrapped in brackets: "{" and
        "}" for green, "[" and "]" for yellow, and "(" and ")" for gray.
        Going from left to right, a letter that is not green is yellow only
        if leftovers(guess, answer) still has one of it to spare, and each
        yellow uses one up. Ex: score("speed", "abide") returns
        "(s)(p)[e](e)[d]", since abide has only one e to spare, and
        score("sheep", "geese") returns "[s](h){e}[e](p)".
    """
    pass


if __name__ == "__main__":
    # Do not edit the main block. It replays a game once score() works.
    answer = "geese"
    guesses = ["eerie", "sheep", "these", "geese"]
    for turn in range(len(guesses)):
        guess = guesses[turn]
        print(f"Guess {turn + 1}: {score(guess, answer)}")
