Skip to content

Maple: Tiffany and Rhyannon#39

Open
rhyannonjoy wants to merge 18 commits intoAda-C16:masterfrom
rhyannonjoy:master
Open

Maple: Tiffany and Rhyannon#39
rhyannonjoy wants to merge 18 commits intoAda-C16:masterfrom
rhyannonjoy:master

Conversation

@rhyannonjoy
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Collaborator

@spitsfire spitsfire left a comment

Choose a reason for hiding this comment

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

Tiffany and Rhyannon, heck yeah! This looks great! Easy to read, loved all the helper functions you constructed in order to make get_highest_word_score much simpler to read.

Nicely done!

Comment thread adagrams/game.py
Comment on lines +26 to +34
i = 0
while len(letters) < 10:
random_letter = random.choice(list(LETTER_POOL))
if letter_count[random_letter] > 0:
letter_count[random_letter] -= 1
letters.append(random_letter)
if letter_count[random_letter] < 0:
letters.remove(random_letter)
i += 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we don't actually need i in this loop! the while loop is checking the length of the letters list, which is not dependant on i.

let's get rid of line 26 and line 34!

Comment thread adagrams/game.py
returns an array of random 10 strings from LETTER_POOL
"""
letters = []
letter_count = LETTER_POOL.copy() # could also be letter_bank, but not sure yet
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 good job reducing side effects

Comment thread adagrams/game.py
otherwise returns False.
"""
#this method copies the letter bank list
letter_bank_duplicate = letter_bank[:]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 keeps side effects away

Comment thread adagrams/game.py
return letters

# Wave 2
def uses_available_letters(word, letter_bank):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Comment thread adagrams/game.py
returns extra points if word is seven letters or more
"""
total_score = 0
word_case_check = word.upper()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 good idea

Comment thread adagrams/game.py


# Wave 4
def get_score_dict(word_list):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 love a good helper function!

Comment thread adagrams/game.py
Comment on lines +94 to +97
score_dictionary = get_score_dict(word_list)
top_word = max(score_dictionary, key=score_dictionary.get)
all_scores = get_score_dict(word_list).values()
top_word_score = max(all_scores)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

look at all these helper functions helping!!!

Comment thread adagrams/game.py
elif len(word) == 10:
top_word = word

return top_word, top_word_score No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 nice tuple return!

Comment thread adagrams/game.py
'N': 6, 'O': 8, 'P': 2, 'Q': 1, 'R': 6, 'S': 4, 'T': 6,
'U': 4, 'V': 2, 'W': 2, 'X': 1, 'Y': 2, 'Z': 1}

SCORE_CHART = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 nice idea!

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