File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change 11import random
22
33from utils import (get_word_ls ,
4- get_score ,
4+ get_score ,
5+ get_score_advanced ,
56 did_user_win ,
67 get_user_word
78 )
@@ -32,6 +33,7 @@ def main():
3233
3334 trials = 6 # Max Number of Trials
3435
36+ # Prompt user if they want to check if their guess word is valid (i.e. word is in ALL_WORDS)
3537 while True :
3638 try :
3739 check_all_words = input (f"Do you want to check if your guess word exist and valid? (yes/no) >>> " )
@@ -49,12 +51,33 @@ def main():
4951 print (err )
5052 continue
5153
54+ # Prompt user if they want to use the advanced scoring algorithm
55+ while True :
56+ try :
57+ use_adv_scoring = input ("Do you want to use the advanced scoring algorithm? (yes/no) >>> " )
58+ use_adv_scoring = use_adv_scoring .replace (" " , "" )
59+ if use_adv_scoring == "yes" :
60+ use_adv_scoring = True
61+ break
62+ elif use_adv_scoring == "no" :
63+ use_adv_scoring = False
64+ break
65+ else :
66+ print (f"Could not parse your input. Please try again ...\n " )
67+ continue
68+ except Exception as err :
69+ print (err )
70+ continue
71+
5272 while True :
5373 print (f"\n You have { trials } tries remaining. Good luck!" )
5474
5575 user_word = get_user_word (target_word , valid_words , check_all_words = check_all_words ) # Get User Guess Word
56-
57- scores = get_score (user_word , target_word ) # Evaluate User Score
76+
77+ if use_adv_scoring :
78+ scores = get_score_advanced (user_word , target_word )
79+ else :
80+ scores = get_score (user_word , target_word ) # Evaluate User Score
5881
5982 # Print Results
6083 print (' ' .join ([* user_word .upper ()]))
You can’t perform that action at this time.
0 commit comments