Ismael Garrido wrote:
Kent Johnson wrote:
If you make _cambiarCelda() check for out-of-range indices then you
could get rid of _descartarNegativos() and clean up click() considerably.
def _cambiarCelda(self, i, j):
if not (0<=i<3 and 0<=j<3):
return
Without the 'not' (it was pretty funny to see it do only the wrong
moves!) :-D
I think the 'not' is correct as I wrote it but a simpler way would be
def _cambiarCelda(self, i, j):
if 0<=i<3 and 0<=j<3:
self.tablero[i][j] = not self.tablero[i][j]
Kent
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor