Created
November 21, 2018 14:00
-
-
Save gfhuertac/88600b595601bc23239864e237adb88e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
#Escribe verifica(matriz) acá | |
tablero = numpy.zeros([6,7], dtype=int) | |
turno = 1 | |
while(verifica(tablero) == 0): | |
if tablero.all(): | |
print("No hay ganadores") | |
exit() | |
while(True): | |
columna = int(input("Jugador " + str(turno) + " ingrese columna:")) | |
if columna < 1 or columna > tablero.shape[1]: | |
print("Columna inválida. Intente nuevamente") | |
elif tablero[:,columna-1].all(): | |
print("Columna llena. Intente con otra") | |
else: | |
break | |
posicion = numpy.where(tablero[:,columna-1] != 0) | |
tablero[tablero.shape[0] - len(posicion[0]) - 1, columna-1] = turno | |
print(tablero) | |
turno = turno%2 + 1 | |
print("Ha ganado el jugador", verifica(tablero)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment