#!/usr/bin/env python3
#-*- encoding: utf-8 -*-

import subprocess
import re
import os
import Levenshtein
import codecs


def help_():
    regles = """Lancer une partie : !play .\n
Commencer la partie : !start .\n
Consulter les scores : !scores .\n
Pour rejoindre une partie, dire moi ou approchant.\n
Pour donner le mot que vous pensez être la réponse : \" mon_mot ! \" """
    return regles


def checkin(word, char, boolword):
    nb, is_in = 0, False
    for i,j in enumerate(word):
        if j == char:
            (nb, is_in, boolword[i])  = (nb + 1, True, True) 
    return (is_in, nb, boolword)


def printword(mystery_word, bool_count):
    m_str = ''
    for i,j in zip(mystery_word, bool_count):
        m_str += '%s '%i if j == True else '_ '
    return m_str


def refresh_scores(dico_perm, dico_temp):
    for i,j in dico_temp.items():
        dico_perm[i] += j

def print_scores(dico):
    return ' / '.join('%s : %s' %item for item in dico.items())

def won(bool_tab):
    return all(x == True for x in bool_tab)

def nb_missed(bool_tab):
    return len([x == False for x in bool_tab])
