Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

magnitude

I am having trouble implementing "play previous hand" in the Word Game problem. When the player enters "r" for "replay", the game displays, instead of the original hand, the hand with letters missing. I think there is a side-effect going on in my update_hand function, and i don't know how to identify or fix it. Here is the relevant code. Thanks! http://dpaste.com/1046521/

  • one year ago
  • one year ago

  • This Question is Open
  1. bwCA
    Best Response
    You've already chosen the best response.
    Medals 2

    2008 or 2011? update_hand is not supposed to mutate hand - yours does however, the symptom you describe is is caused elsewhere - where does hand come from?

    • one year ago
  2. magnitude
    Best Response
    You've already chosen the best response.
    Medals 0

    2011. I changed my update_hand first copying hand http://dpaste.com/1047548/ By not mutating the hand, I am able to use replay correctly. I am a little confused why this happened. Why is it that when I set hand = updated_hand inside play_hand it effects the hand in play_game() only when hand is mutated? Is it because when hand is created in play_game it points to the full hand. Then in play_hand, hand eventually points to a new value equal to updated_hand. Thus, when play_hand ends, hand points what it did originally in play_hand?

    • one year ago
  3. bwCA
    Best Response
    You've already chosen the best response.
    Medals 2

    http://docs.python.org/2/reference/datamodel.html#objects-values-and-types

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.