-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolver.py
35 lines (29 loc) · 1.01 KB
/
solver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Import RegEx
from dictionary import *
#Keep looping the command inputs.
def solveProblem():
tried_input = "";
wordSolved = 0
while (not wordSolved):
#Request word input
print("Enter the currently known letters and use \".\" if the letter is unknown.")
word_input = input("Enter word: ")
#print("Enter letters that you have tried without spaces. Press enter if no letters listed.")
#tried_input = input("Tried letters: ")
matches = getMatches(word_input, tried_input)
if(len(matches) > 5):
print("Too many possible results to guess.")
outputTuple = getLetterProbability(word_input, matches)
print("The next most likely letter is an \"" + outputTuple[0] + "\" with a chance of " + outputTuple[1] + "%")
tried_input += outputTuple[0];
elif(len(matches) == 1):
print("The word is " + matches[0])
wordSolved = 1
elif(len(matches) == 0):
print("There is no matching word")
return;
else:
print("Your answer is one of the following:")
for word in matches:
print(word)
print("---");