Fonction "Know Letters"
This commit is contained in:
parent
758d6bb0bb
commit
f9cf15d487
13
wgamesolv.py
13
wgamesolv.py
@ -80,7 +80,16 @@ def resolv_len(liste, lenght):
|
||||
# if patternEval == patternCount :
|
||||
# patternFilter.append(mot)
|
||||
#
|
||||
# Known Letters : élimination des mots ne comprenant pas les lettres validées (hors pattern)
|
||||
|
||||
def resolv_kl(liste, lettres):
|
||||
# Known Letters : élimination des mots ne comprenant pas les lettres validées (hors pattern)
|
||||
lettres = list(set(list(lettres)))
|
||||
MotsRestants = []
|
||||
for mot in liste:
|
||||
if len(set(lettres).intersection(mot)) == len(lettres):
|
||||
MotsRestants.append(mot)
|
||||
return MotsRestants
|
||||
|
||||
#if kl:
|
||||
# if patternFilter:
|
||||
# mots = patternFilter
|
||||
@ -198,6 +207,8 @@ if __name__ == "__main__":
|
||||
else:
|
||||
print("Hmmm... Je crois qu'on s'est perdu...")
|
||||
exit(0)
|
||||
if args.knownLetters:
|
||||
liste = resolv_kl(liste, args.knownLetters)
|
||||
if len(liste) > 1:
|
||||
print(liste)
|
||||
print(f"Il y a {len(liste)} mots dans la liste")
|
||||
|
Loading…
Reference in New Issue
Block a user