Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

Hey, I need a little help with the "Ghost" part of PS5. My code is almost done, but I'm running into a problem and can't figure out what I'm doing wrong. I have two functions that should trigger gameover to be true, but they don't seem to be doing this. If you spell out "faces", it tells you that you've spelled a word, but I dont think it sets gameover to true, and I don't know why. Same thing if you spell "Pyz" it will tell you that you aren't on the way to a word, but it doesn't set gameover to be true... http://dpaste.com/615526/

OpenStudy (anonymous):

Your gameover functions are embedded in your functions, so they only change the local 'gameover', not the global one. One way to fix it would be for to put gameover = true with lines 85 and 86 (although you'll also need to add a return False somewhere in waytoword)

OpenStudy (anonymous):

got it! thanks a bunch

OpenStudy (anonymous):

about 'def waytoword(gamestring)', try to use bisearch. It will be faster a lot. wordlist has 83,667 words so straight forward iteration is bad solution.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!