-
Notifications
You must be signed in to change notification settings - Fork 36
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
Adagrams Prioject Submission: Gessica and Pauline Pair Programming Submission #5
base: master
Are you sure you want to change the base?
Conversation
…r to /lib due to file path testing issues with wave-5-game.rb
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.
Overall well done. See my notes about the draw_letters
method. Otherwise outstanding work. Nice work getting the bonus.
while letter_bucket.length < 10 | ||
temp_letter_hash = letter_array[rand(26)] | ||
temp_letter = temp_letter_hash.keys[0] |
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 actually gives you an equal chance of drawing an "A" and a "Z", which shouldn't be possible.
Consider instead adding 9 As and 2Bs etc to an array and then sampling that array.
|
||
# verify if the letters in hand are included in the collection of available letters in the array. verify if they are an anagram of some or all of the given letters in hand. | ||
|
||
def uses_available_letters?(input, letters_in_hand) |
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.
👍
|
||
score = word.length > 6 ? 8 : 0 | ||
|
||
word.each_char{|c| score += score_word[c.upcase]} |
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.
Consider using reduce
or sum
methods.
#using the score_word hash to find the score of each word. | ||
def score_word(word) |
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.
👍
winning_score = word_score_hashes.max_by{|word| word[:score]} | ||
|
||
# find word(s) with same winning_score | ||
winning_word = word_score_hashes.select{|word| word[:score] == winning_score[: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.
Good use of select
and max_by
return winning_word | ||
end | ||
|
||
def is_in_english_dict?(input) |
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 work using a CSV file as a dictionary
Assignment Submission: Adagrams
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
Enumerable
mixin? If so, where and why was it helpful?