from game.console import Console
from game.seeker import Seeker
from game.hider import Hider

# Direct the game, standard loop, brings all of the pieces together


class Director:

    def __init__(self):
        """The class constructor.

        Args:
            self (Director): an instance of Director.
        """
        self.console = Console()
        self.seeker = Seeker()
        self.keep_playing = True
        self.hider = Hider()

    def start_game(self):
        """Starts the game loop to control the sequence of play.

        Args:
            self (Director): an instance of Director.
        """
        while self.keep_playing:
            self.get_inputs()
            self.do_updates()
            self.do_outputs()

    def get_inputs(self):

        # Gets the message depending on how big of a jump of a guess they guessed
        message = self.seeker.get_message()

        # Prints message
        self.console.write(message)

        # Gets input from user and sets it to location
        location = self.console.read_number("Enter a location [1-1000]: ")
        location = input("enter location aishdf ")

        # Appends distance of seeker to hider onto the end of array, and sets the location.
        self.seeker.move(location)

    def do_updates(self):
        """Updates the important game information for each round of play. In 
        this case, that means the hider watches the seeker.

        Args:
            self (Director): An instance of Director.
        """

        # What I need to code in the hider,
        self.hider.watch(self.seeker.location)

    def do_outputs(self):
        """Outputs the important game information for each round of play. In 
        this case, that means the hider provides a hint.

        Args:
            self (Director): An instance of Director.
        """
        hint = self.hider.get_hint()
        self.console.write(hint)
        self.keep_playing = (self.hider.distance[-1] != 0)
