0

I'm trying to understand this program so I can get a better grip on Python programming. I was fiddling with the program and was trying to figure out how to run it, but everytime I included a play_pigs() call, I was given an error saying argument was expected. And that is true since the code says it needs a '(self)' argument,

def play_pigs(self):

How is it that this program is ran then? I'm not really understanding this part, but I think I understand some of the other parts of the code.

Code: http://ideone.com/LuRLOu

Ozera
  • 115
  • 7

1 Answers1

1

play_pigs() is a method of the class PlayerSet. You will have to get (e. g. create) an instance of this class on which you then can call play_pigs() like this, for instance:

playerSet = PlayerSet(1, "foo")  # or some other way to get such an instance
playerSet.play_pigs()  # do not pass "self" here, as this is implicit already

This answers your direct question. I didn't check if this works at all since this would be out of the scope of SO.

Alfe
  • 56,346
  • 20
  • 107
  • 159