[Tutor] list of objects?
bgailer at gmail.com
Wed Nov 16 03:18:46 CET 2011
On 11/15/2011 8:40 AM, Elwin Estle wrote:
> I am attempting to write a text based spider solitaire game.
What are the rules of your version of Spider? The only spiders I know
have 10 dealt piles and 1 draw pile.
I think you have greatly complicated things by using classes. Consider:
deck = random.shuffle(range(13)*8) # list of 108 card "indexes" in
values = "A23456789JQK" # display values corresponding to indexes
piles = [deck[x:x+10] for x in range(0,108,10)]
Anytime you want to display the value of a card use values[cardIndex]
for example to display the last card in each pile:
for pile in piles:
What will your actual display look llike?
Will you completely reprint it after each move, or alter it in place?
How will you get the moves from the player?
Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor