Skip to content

Maple - Tiana Wofford and Rachael McBride #47

Open
rachael-mcbride wants to merge 6 commits intoAda-C16:masterfrom
rachael-mcbride:master
Open

Maple - Tiana Wofford and Rachael McBride #47
rachael-mcbride wants to merge 6 commits intoAda-C16:masterfrom
rachael-mcbride:master

Conversation

@rachael-mcbride
Copy link
Copy Markdown

No description provided.

Comment thread adagrams/game.py
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
Copy Markdown

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

Comment thread adagrams/game.py

return user_hand

def uses_available_letters(word, letter_bank):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

great job

Comment thread adagrams/game.py
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
Copy Markdown

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()]

Comment thread adagrams/game.py

return score

def get_highest_word_score(word_list):
Copy link
Copy Markdown

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
Copy Markdown

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