import random
from pathlib import Path

NUM_INCORRECT = 6
HANGMANPICS = [
    """
  +---+
  |   |
      |
      |
      |
      |
=========""",
    """
  +---+
  |   |
  O   |
      |
      |
      |
=========""",
    """
  +---+
  |   |
  O   |
  |   |
      |
      |
=========""",
    """
  +---+
  |   |
  O   |
 /|   |
      |
      |
=========""",
    """
  +---+
  |   |
  O   |
 /|\\  |
      |
      |
=========""",
    """
  +---+
  |   |
  O   |
 /|\\  |
 /    |
      |
=========""",
    """
  +---+
  |   |
  O   |
 /|\\  |
 / \\  |
      |
=========""",
]


def print_hangman(num: int) -> None:
    if num >= 0 and num < len(HANGMANPICS):
        print(HANGMANPICS[num])


def load_words(filename: Path | str = Path("./clean.txt")) -> list[str]:
    if isinstance(filename, str):
        filename = Path(filename)
    with filename.open() as file:
        return file.read().splitlines()


def get_word(words: list[str]) -> str:
    pass


def check_guess(word: str, guess: str, guessing: list[str]) -> bool:
    pass


def play() -> None:
    # load the dictionary of words and pick a random word

    # initialize the empty word to fill in

    # initialize incorrect guess tracking

    # print out the start of the game

    # Game loop
    while True:
        pass
        # get player guess (word or letter)

        # make sure the input is only letters

        # if the guess is as long as the word,
        # check if player guessed the word correctly

        # otherwise, make sure the guess is only 1 letter

            # check if the guess is correct

            # if the letter is not correct and it isn't one of the letters
            # we have already guessed, track the incorrect letter and
            # increment the number of incorrect guesses

            # otherwise, the guess was correct so we should
            # check if they have guessed the whole word yet

        # if we have reached or exceeded our allotted number of
        # incorrect guesses, show what the word was and exit the game

        # if we are still playing, print the current state of the game


if __name__ == "__main__":
    play()
