Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rachael-mcbride
Copy link

No description provided.

Comment on lines +33 to +36
letter_pool = []
for letter, frequency in LETTER_KEY.items():
for number in range(frequency):
letter_pool.append(letter)
Copy link

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):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job

Comment on lines +55 to +69
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
Copy link

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:

Suggested change
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):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great approach using tuples!

@tgoslee
Copy link

tgoslee commented Oct 5, 2021

Great work! I added some comments on refactoring and using constant global variables!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants