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

davek

anyone try to get the oldmaid code to work? it was given in chaps 15 and 16. to play it says, import cards. but idle doesn't know what that means. anyone know the correct way to call this program to action?

  • one year ago
  • one year ago

  • This Question is Closed
  1. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    The python file cards must be in the main folder/source folder.

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

    Great. do you know where to find this file? i appreciate the help!

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

    i.e. it should be sourced to .../python33/... instead of the desktop and elsewhere if you're using the IDLE

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

    OK. so split the 'cards' coding from the oldmaidgame code and then importing cards worked. but now i get CardGame not defined. CardGame is a class in cards. hmmm. any thoughts? much appreciated.

    • one year ago
  5. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    you might need to call cards.CardGame.

    • one year ago
  6. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    if you don't want to add that troublesome cards. prefix, just do from cards import * to import all the classes and functions.

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

    wow, thought that was it. tried both import and cards. and both times got CardGame not defined. but this is CardGame in cards class CardGame: just like in chapter 16. doesn't make sense.

    • one year ago
  8. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    may i get the link and code? if there is a CardGame class in the cards file, then importing it and calling (cards.Cardgame) should do it.

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

    sure. how do i post it? github?

    • one year ago
  10. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    your choice. git hub is fine

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

    here is the github link https://gist.github.com/4645924 thank you for taking the time.

    • one year ago
  12. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    no worries :P I'm just interested. python 2.7, i take it?

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

    yes. in the course the told us to use this version

    • one year ago
  14. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    you have two OldMaidHands. but this should work. http://dpaste.com/892967/

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

    I see what you did. makes sense. i'm getting no module named cards. just checked the directory. both files cards and OldMaidGame (yours and mine) are in the python26 directory on the local disc.

    • one year ago
  16. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    ah. i just changed to do import first and calling the OldMaidGame from OldMaidGame it self

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

    right. importing * so don't need cards.

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

    feel like letting this one go. something's not right.

    • one year ago
  19. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    import * means import everything in cards. though running it gives an almost infinite loop of them exchanging cards....

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

    I copied your link and tried running it and got the no module named cards note i figured the from cards import * would take in all classes from cards. but it is asking for the cards module. maybe i should put the file cards in the oldmaidgame file before the oldmaidgame class.

    • one year ago
  21. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    it works fine with mine though....maybe IDLE crashed?

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

    ok. maybe i'll reboot. this is nuts. appreciate the help very much. thanks.

    • one year ago
  23. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 1

    lol you're welcome. :)

    • 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.