-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maple - Tiana Wofford and Rachael McBride #47
base: master
Are you sure you want to change the base?
Conversation
letter_pool = [] | ||
for letter, frequency in LETTER_KEY.items(): | ||
for number in range(frequency): | ||
letter_pool.append(letter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest looking into copy()
and deepcopy()
to create a copy of your letter pool https://docs.python.org/3/library/copy.html
if user_hand.count(letter_to_add) < LETTER_KEY[letter_to_add]: | ||
user_hand.append(letter_to_add) | ||
|
||
return user_hand | ||
|
||
def uses_available_letters(word, letter_bank): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job
for letter in word: | ||
if letter in ['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T']: | ||
score += 1 | ||
elif letter in ['D', 'G']: | ||
score += 2 | ||
elif letter in ['B', 'C', 'M', 'P']: | ||
score += 3 | ||
elif letter in ['F', 'H', 'V', 'W', 'Y']: | ||
score += 4 | ||
elif letter in ['K']: | ||
score += 5 | ||
elif letter in ['J', 'X']: | ||
score += 8 | ||
elif letter in ['Q', 'Z']: | ||
score += 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could create a dictionary with these as key-value pairs. Or you could create a constant global value that holds this data and then do something like:
for letter in word: | |
if letter in ['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T']: | |
score += 1 | |
elif letter in ['D', 'G']: | |
score += 2 | |
elif letter in ['B', 'C', 'M', 'P']: | |
score += 3 | |
elif letter in ['F', 'H', 'V', 'W', 'Y']: | |
score += 4 | |
elif letter in ['K']: | |
score += 5 | |
elif letter in ['J', 'X']: | |
score += 8 | |
elif letter in ['Q', 'Z']: | |
score += 10 | |
for letter in word: | |
score += LETTER_VALUES[letter.upper()] |
if len(word) >= 7 and len(word) <= 10: | ||
score += 8 | ||
|
||
return score | ||
|
||
def get_highest_word_score(word_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great approach using tuples!
Great work! I added some comments on refactoring and using constant global variables! |
No description provided.