Hello all, I have a 2d list being used for a battleship game. I have structured the program so that it uses a grid class, which implements this array along with a bunch of other methods and vars. For example, to get at the top left square, you would say: Grid.getSquareAt(0,0) and inside getSquareAt is simply: def getSquareAt(self, x, y): return self.b[x][y] #b is the internal 2d list for the class
However, I am getting very confused with indexing. I keep getting errors about list index out of range and I am not sure why. I have a feeling that using 2d lists is supposed to go like a matrix (row,column) and not like a coordinate plane (column, row). Any suggestions? If you want the full source, just let me know and I will update the zip file on my server and send the link. TIA! -- Have a great day, Alex (msg sent from GMail website) [email protected]; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
