-
Notifications
You must be signed in to change notification settings - Fork 27
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
Leanna/Shelan's Adagram #14
base: master
Are you sure you want to change the base?
Conversation
Our answers are in the github folder inside adagrams.rb |
AdagramsWhat We're Looking For
|
# #-------------WAVE-1--PASS----------------- | ||
def draw_letters | ||
#string of letters of the correct quantity | ||
letters = ("A" * 9) + ("B" * 2) + ("C" * 2) + ("D" * 4) + ("E" * 12) + ("F" * 2) + ("G" * 3) + ("H" * 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) + ("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.
Very good idea
if letters_in_hand.include?(let) #if the input letter matches a letter in hand | ||
tru_fals << letters_in_hand.delete_at(letters_in_hand.index(let)) #delete letter from the one in hand & push to tru_fals | ||
else | ||
tru_fals << false #if no match, pushes 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.
why not just return false
at this point?
if score == winner[:score] #only exceptions are ties | ||
|
||
if winner[:word].length == 10 | ||
winner[:word] = winner[: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.
Here you're swapping the word with itself. Seems unnecessary
winner[:score] = score | ||
|
||
elsif word.length == 10 && winner[:word].length == 10 | ||
winner[:word] = winner[: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.
Again repetition, this elsif
is redundant.
winner[:word] = winner[:word] | ||
winner[:score] = winner[:score] | ||
|
||
elsif word.length < winner[:word].length && word.length != 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.
I think this is redundant.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?