[Tutor] Improving My Simple Game Code for Speed, Memory and Learning
alan.gauld at btinternet.com
Mon Jan 12 23:00:00 CET 2015
On 12/01/15 20:28, WolfRage wrote:
> anyone has any improvements or things to think about, I would love to
> hear it.
Sorry, no time to read the detail, but one thing I thought might be
handy is to convert the draw method to return a string and make it the
__str__methodf of the grid.
Then the draw method becomes print(self)
And you can also just use print(aGrid) etc.
Something like (untested):
output = 
for row in self.transposed_grid:
for node in row:
s += (str(node) + ' | ')
def draw(self): print (self)
Just a thought.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor