import asyncio
import signal


class Game:
    def __init__(self, input_handler, events, game_state):
        self.input_handler = input_handler
        self.events = events
        self.game_state = game_state
        signal.signal(signal.SIGINT, self.interrupt)
        self.is_running = asyncio.Condition()
        pass

    def interrupt(self):
        print('Received SIGINT. Stopping Game :-)')
        self.is_running.release()

    async def run(self):
        self.is_running.acquire()
        asyncio.run(self.input_handler.handleInputs())

        await self.is_running.wait()
        pass
