Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def imprime_tablero(tablero):
- for l in tablero:
- print("|" , " ".join(l), "|")
- print("")
- def revisa_ganador(sim, mat):
- objetivo = len(mat)
- #filas
- for l in mat: #cada linea
- if l.count(sim)== objetivo:
- return True
- #diagonales
- comp = []
- comp_i = []
- for i in range(objetivo):
- comp.append(mat[i][i])
- comp_i.append(mat[i][-(i+1)])
- if comp.count(sim)== objetivo or comp_i.count(sim)==objetivo:
- return True
- #columnas
- for j in range(objetivo):
- columna = []
- for l in mat:
- columna.append(l[j])
- if columna.count(sim) == objetivo:
- return True
- return False
- posicion = int(input())
- auxiliar = posicion
- tj1 = posicion//10
- tj2 = auxiliar%10
- if tj1 != 0 and tj2 !=0:
- tj1 -= 1
- tj2 -= 1
- tablero_jugadores = [["-","-","-"], ["-","-","-"],["-","-","-"]]
- tablero_jugadores[tj1][tj2] = "x"
- tablero = imprime_tablero(tablero_jugadores)
- print(tablero)
- posicion = int(input())
- auxiliar = posicion
- tj1 = posicion//10
- tj2 = auxiliar%10
- if tj1 != 0 and tj2 !=0:
- tj1 -= 1
- tj2 -= 1
- tablero_jugadores[tj1][tj2] = "O"
- tablero += imprime_tablero(tablero_jugadores)
- print(tablero)
- #victorio = revisa_ganador(imprime_tablero, tablero_jugadores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement