Skip to content

Sapphire - Ericka M#118

Open
erickalucia wants to merge 8 commits intoAda-C19:mainfrom
erickalucia:main
Open

Sapphire - Ericka M#118
erickalucia wants to merge 8 commits intoAda-C19:mainfrom
erickalucia:main

Conversation

@erickalucia
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@tildeee tildeee left a comment

Choose a reason for hiding this comment

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

Nice work on this, Ericka. Because wave 4 wasn't quite finished, I'm marking this as yellow as a sign to review.

Overall, your approaches to all of the completed functions are exactly what I'm looking for. Your code is overall clean and straightforward. I've added a few comments for ways I think your code style can improve. If it begins with [nit], it's because it's feedback that is a small code style issue that I'm nitpicking.

I've given some feedback on where I think get_highest_word_score could go, so let me know if you have questions!

Additionally:

  1. Keep using print statements to test things in your code! :) However, next time there's a final project submission, it will be good to catch those and delete them.
  2. For your git commits, I would expect that the messages start with a verb and describe the changes in the code, and not reference "Wave 2" etc.

That being said, good work on this project. This is my first time getting to know your code, and I know I'm a new reviewer. Please let me know what questions or comments you have, here or through Slack.

Comment thread adagrams/game.py
Comment on lines +56 to +57
letter_score = (letter_pool_score[letter])
letter_scores.append(letter_score)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

letter_score is only being used once here, so I think it feels appropriate to inline this. For example, we could refactor this to:

        letter_scores.append(letter_pool_score[letter])

Comment thread adagrams/game.py
letter_scores = []
word = word.upper()
for letter in word:
letter_score = (letter_pool_score[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.

[nit] as a minor note, I'm unsure why there are () here. For me, I think this code reads better without the ().

Comment thread adagrams/game.py
for letter in word:
letter_score = (letter_pool_score[letter])
letter_scores.append(letter_score)
if (len(word)) >= 7:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] Similar to above, I would expect this to be if len(word) >= 7:. When we change it, the tests still pass!

Comment thread adagrams/game.py
Comment on lines +53 to +60
letter_scores = []
word = word.upper()
for letter in word:
letter_score = (letter_pool_score[letter])
letter_scores.append(letter_score)
if (len(word)) >= 7:
letter_scores.append(8)
return sum(letter_scores)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here, you've used letter_scores to hold all of the scores, and then you sum them up in the end. Instead of letter_scores, could we use an integer, and add to that integer instead?

Comment thread adagrams/game.py
Comment on lines +70 to +73
word_score = score_word(word)
winning_word_and_score = (word, word_score)
word_scores.append(winning_word_and_score)
highest_score = max(word_scores)
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 see the makings of a working get_highest_word_score function!!! To keep pushing on this, I would ask the following questions: (PS: these are all style questions, there is no right answer)

  1. It looks like you're trying to make word_scores a list of tuples, where each item is a (word, score). From a list of tuples, how can you look at score inside that tuple?
  2. There is only one highest winning_word_and_score. When should that winning_word_and_score be re-assigned?

Comment thread adagrams/game.py

def uses_available_letters(word, letter_bank):
pass
letters_copy = 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.

Cool way to use slicing to make a copy

Comment thread adagrams/game.py
import random
import copy

letter_pool_frequency = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because these variables don't get re-assigned, it might be good to make them constants

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.

2 participants