Hi all,
I am a newbie as far as python is concerned ... I am trying to write a code
for playing bridge in obj oriented manner ..

Well ... i have this small problem:

class hand:
   def __init__(self,set_of_cards=[]):
       self.set_of_cards=set_of_cards
   card_played_flag =0
   def play(played_card):
       for i in self.set_of_cards:
           if self.set_of_cards[i] == played_card:
               self.set_of_cards.remove(played_card)
    def sort_hand():
       for i in self.set_of_cards:
           for j in self.set_of_cards:
               if self.set_of_cards[j].face<self.set_of_cards[i].face
               self.set_of_cards[j],self.set_of_cards[i]=self.set_of_cards
[i],self.set_of_cards[j]
        for i in self.set_of_cards:
           for j in self.set_of_cards:
               if self.set_of_cards[j].suit<self.set_of_cards[i].suit
               self.set_of_cards[j],self.set_of_cards[i]=self.set_of_cards
[i],self.set_of_cards[j]

I have created card as a class with the attributes of suit face so ..
card(suit,face)

So my question is this ---

The compiler doesnt recognise that there is self.set_of_cards[j] can be a
card. It gives a syntax error.
Also I have not created any instance of the class (Can that be a problem)

So how do i fix this?
Also can I specify that the list set_of_cards has only card objects? IF yes
how?

Thanks a lot.

Shyam Sundar
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to