View Single Post
Old Nov 18th, 2007, 12:01 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Pacman in Python Code

@mrynit :

There's nothing wrong really with having those classes in the same file... in fact I'd say you want them there. It's when your classes handle functionality, in an isolated fashion, that your main program requires, that you don't need them in the same place... I'd say.


@acwbrat :

Line 128:
width = len(layout)[0])
Is a syntax error. (Brackets are mismatched)

Lines 146-147:
      garridoman = Garridoman(self, point)
      self.movables.append(garridoman)
Doesn't have the proper indentation. (Must be aligned within the elsif block)

Line 150:
self.map[y][x] Food(self, point)
That's not even a valid statement. I assume you're trying to assign self.map[y][x] to Food. Assignment requires an '=' inbetween.

Line 153:
elif character == 'G'
You can't have an elif statement start off an 'if' clause. An if statement must be the first statement in the clause. Furthermore, an if statement needs a colon at the end to denote the beginning of a new block.


I'm sorry but, I have to stop here. These are all mistakes before the program even finishes compiling... meaning they are the most basic/fundamental and easily fixable errors.

If you had spent even an hour looking at previous Python code, or reading a basic tutorial, you would know how to fix all of these errors in an instant. Sorry, but that Pacman tutorial is obviously not a good starting point, I don't think you're learning anything. Take a few steps back and try something else.
Sane is offline   Reply With Quote