-
Couldn't load subscription status.
- Fork 29
Sockets - Kirsten and Cyndi #5
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
base: master
Are you sure you want to change the base?
Conversation
AdagramsWhat We're Looking For
|
| letters_array = [] | ||
| i = 0 | ||
| until i == 10 | ||
| char = LETTER_POOL.to_a.sample[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.
By this logic, you're as likely to draw an e as you are a z!
Instead, you might create an array containing all the letters, with code similar to this:
letter_counts = {
# the hash you had before
}
letters = []
letter_counts.each do |letter, count|
count.times do
letters << letter
end
endThen you could pull a random tile with letters.sample and get a nice even distribution.
| check = true | ||
| input.split("").each do |char| | ||
| if !popping_array.include?(char) | ||
| check = false |
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.
I'll leave this as a "vague thing" to think about... I think that while you iterate through input.chars, you can actually determine that uses_available_letters? can return false before the loop finishes.
Remember, when you use the return keyword, it will kick the program execution out of the method early, and return whatever value you give it.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerablemixin? If so, where and why was it helpful?