ps6c: I can NOT figure out how to set-up "pick_best_word". Any suggestions? Nested loops? Recursive? I've dead ended in multiple ways and I can't look at it any more today. I can itterate over the sequential combinations of 'hand' but I can't think of how to test all combinations. Seems like a recursive OR multi-nested problem but I just can't get my head around it. Blah. ps6c: I can NOT figure out how to set-up "pick_best_word". Any suggestions? Nested loops? Recursive? I've dead ended in multiple ways and I can't look at it any more today. I can itterate over the sequential combinations of 'hand' but I can't think of how to test all combinations. Seems like a recursive OR multi-nested problem but I just can't get my head around it. Blah. @MIT 6.00 Intro Co…
Without giving it away: try iterating through points_dict and testing each word against the hand. If you need another clue, let me know! This problem took me a looong time to figure out.
I'm dying. I've tried so many variations and I am having a hard time just getting the words with ONLY the dealt letters... I thought I had it, then i changed some things and lost it. My lack of a system has me running in circles... Here's the latest. WARNING: it's bad... http://codepad.org/EOumwxTq Any suggestions?
Not a bad start! Line 12 is spot on. I would scrap everything before that and just declare an empty bestWord string variable. After line 12, maybe consider using your is_valid_word and get_word_score functions on the words in ORDERED_POINTS. Hope that helps!
Good advice. I do NOT know why it didn't occur to me to use prior functions. Still not thinking that way. Can someone advise why I am getting a list consisting of individual letters on the output? http://codepad.org/rdflD8Ms I've tried making the variable a string (best_word = "") and a list (as it is now). I would like my output to be a list of strings (word in ORDERED_POINTS)... Which in a way I guess it is but I don't know why the output is breaking the 'word in ORDERED_POINTS' down into individual letters? My thought is that it is in the way I'm storing it (best_word += word)...but even with trying a few different things I can't get it to work.
I should mention that 'ORDERED_POINTS' is a dictionary of words and their value (value being the scrabble score)... Not sure if that has an effect...
Join our real-time social learning platform and learn together with your friends!