-
Notifications
You must be signed in to change notification settings - Fork 135
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
AbigailGoodmanC19ATLAdagrams #129
base: main
Are you sure you want to change the base?
Conversation
|
||
|
||
|
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.
It’s good practice to avoid committing extra or white space when submitting a PR.
LETTER_POOL = { | ||
'A': 9, | ||
'B': 2, | ||
'C': 2, | ||
'D': 4, | ||
'E': 12, | ||
'F': 2, | ||
'G': 3, | ||
'H': 2, | ||
'I': 9, | ||
'J': 1, | ||
'K': 1, | ||
'L': 4, | ||
'M': 2, | ||
'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 | ||
} |
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.
Hi Abby! Great job completing Adagrams! Congrats on your first project at Ada 🎉 Excellent choice with this data structure 💯
letter_list = [] | ||
for letter in LETTER_POOL.keys(): | ||
letter_list += LETTER_POOL[letter] * letter | ||
# print(letter_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.
It’s good practice to avoid committing commented out code when submitting a PR.
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.
A better place for this code would be inside the draw_letters()
function since we're only using the letter_list
in this function. It should live there 👍🏾
# letter_bank = str(input("please input an anagram ")) | ||
# while type(word) == str: |
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.
Be sure to avoid committing commented out code when submitting a PR.
def uses_available_letters(word, letter_bank): | ||
pass | ||
# letter_bank = str(input("please input an anagram ")) | ||
# while type(word) == str: | ||
list_copy = copy.deepcopy(letter_bank) | ||
|
||
for character in word.upper(): | ||
if character in list_copy: | ||
list_copy.remove(character) | ||
else: | ||
return False | ||
|
||
|
||
return True |
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.
👍🏾
word_score = 0 | ||
scores = {"A" : 1, "E": 1, "I": 1, "O": 1, "U": 1 ,"L": 1, "N": 1, "R": 1, "S": 1, "T": 1, "D": 2, "G": 2,"B": 3, "C": 3, "M": 3, "P": 3, "F": 4, "H": 4, "V": 4, "W": 4, "Y": 4,"K": 5, "J": 8, "X":8 ,"Q": 10, "Z": 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.
This is an optimal data structure for the letter scores, outstanding 💫
if len(word) >= 7: | ||
word_score += 8 |
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.
Nice job with the scoring logic 🎉 We can also combine conditionals in one by checking if the length of the word is greater than 6 and less than 11. Refer to your readme for more on this
|
||
|
||
|
||
|
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.
It’s good practice to avoid committing extra or white space when submitting a PR.
adagrams/game.py
Outdated
def get_highest_word_score(word_list): | ||
pass No newline at end of file | ||
winning_word = '' | ||
|
||
highest_score = 0 | ||
for word in word_list: | ||
word_score = score_word(word) | ||
if word_score > highest_score: # if word_score is greater than the highest score | ||
|
||
highest_score = word_score | ||
winning_word = word # winning words now contains the winning word | ||
elif word_score == highest_score: # and if word_score is equal to the highest word | ||
if len(winning_word) == 10: | ||
pass | ||
elif len(word) < len(winning_word) and len(winning_word) != 10: # nested conditional, if the length of the word is greater than the chosen word | ||
winning_word = word | ||
elif len(word) == 10 and len(winning_word) != 10: | ||
winning_word = word | ||
|
||
|
||
|
||
return winning_word, highest_score |
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.
Nice job translating the highest scoring word logic! Awesome job using swapping to grab the highest score and word! 😁 your comprehension of flow control is stellar & you seem to have put everything from the learn lessons together quite nicely!
No description provided.