How come my comp_choose_word function is randomly stopping at sow for 18 points?

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

How come my comp_choose_word function is randomly stopping at sow for 18 points?

MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

Here is my code, I have clearly shown that the word fast generates more points than the word sow. And it isn't even finding any words past 3 characters. I think something is wrong with the get_perms function. def comp_choose_word(hand, word_list, n): high_score = 0 for length in range(1, n+1): print 'Length:',length for word in get_perms(hand, length): print 'Trying',word if get_word_score(word, n) > high_score: print 'Found higher word',word if is_valid_word(word, hand, word_list): print word,'is valid' high_score = get_word_score(word, n) high_word = word else: print word,'is not valid english word' print high_word,':',high_score hand = {'a':1,'s':1,'t':2,'w':1,'f':1,'o':1} comp_choose_word(hand, word_list, 7) print 'Fast for',get_word_score('fast', 7),'points'
Where are you declaring high_word?
high_word = word

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Anyone? I'd really like to move past this problem set, it's been a week now.
Dordan, I'm afraid I can't really help you without taking a look at all of your code. Could you please stick it into a http://pastebin.com/ or something similar?
Here's ps3a: http://pastebin.com/ewFih5vg and part of ps3b which I'm working on right now, the rest is not needed since I am not that far in ps3b yet: http://pastebin.com/EK8DC7Xa
This type of error is completely new to me. Whenever I've encountered an error in the past, it is either obvious and causes the program not to run, or it just gives back faulty or no results. Never partial results, and I've gone over the pseudocode for both of my files and even tried to partially understand the perm file, but it all seems to make sense to me logically.
Hey Dordan, I managed to have a quick go through your ps3a tonight, I know your original question related to the Part B, but we need this to be rickety-tick before we move on to that. I've made some changes to mainly play_game() and a few bits and bobs about the place. I put in comments about my changes. Let me know how you get on. I tested it several times, with no problems (other than my IDE's ipython hanging sometimes times... which i think is the IDE misbehaving...). I think that there are a bunch of test functions in the problem set zip; I didnt get time to fire them up though. http://pastebin.com/sSGVMWB1

Not the answer you are looking for?

Search for more explanations.

Ask your own question