[Tutor] list of objects?

Elwin Estle chrysalis_reborn at yahoo.com
Tue Nov 15 14:40:24 CET 2011


I am attempting to write a text based spider solitaire game.  I have  a pretty simple card class, and a deck class, which has a list of card objects, which are shuffled, then individual elements are put into self.dealt, which is a 'list of lists' when the cards are dealt.

I am trying to control the visibility of the cards.  There is a small "for" loop in the "deal" method of the deck class, this is intended to toggle the visibility of four of the cards.  It does that just fine, but for some reason, it seems to be randomly toggling the visibility of other cards in the self.dealt list and I am thoroughly confused as to why that is.  Is it something to do with the way objects are referenced?  Is my list of card objects a bad way to approach this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111115/9eefb596/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spider.py
URL: <http://mail.python.org/pipermail/tutor/attachments/20111115/9eefb596/attachment.ksh>


More information about the Tutor mailing list