from tools.klass_hangman import HangManGame
from configparser import ConfigParser
from tools.my_logger import main_logger
from tools.translations import make_translation
if __name__ == '__main__':
    new_game = '1'
    while new_game=='1':
        #conf for a new game is in the ini file
        conf = ConfigParser()
        conf.read('config_hangman.ini')
        try:
            #create new instance of a game
            game = HangManGame(conf['PARAMS']['words_file'], int(conf['PARAMS']['tries']))
            #let's play!
            game.start()
        except Exception as error:
            main_logger.error(f"Error while playing hangman game: {error}")
        new_game = input(make_translation("hangman","new_game"))
