Minmax tictactoe :c Cannot understand why this does not work
bartc
bc at freeuk.com
Wed Apr 25 07:12:30 EDT 2018
On 24/04/2018 23:57, fifii.geral at gmail.com wrote:
> movimientos = []
> for i in range (n):
> for j in range (n):
.....
> auxb = 0
....
> return movimientos[auxb]
What do you mean by 'does not work'?
With input of fila=1, and columna=1, I get an error in the last line
above. Because movimientos is an empty list, but you are accessing the
first element as movimientos[0], because auxb is zero.
I don't understand your program (the layout is fine BTW), but you need
to debug the logic of it. (Being recursive doesn't help.)
Is an empty movimientos allowed at this point or not? Is auxb==0 a legal
index here or not?
(Tip: I used these lines in the input loop to simply testing rather than
having to type them in (as 2 and 2) each time:
fila = 1
columna = 1
)
--
bartc
More information about the Python-list
mailing list