# Start 30/12/24 # Versión 0.2 - 30/12/24 # Por Luipy import socket import easygui cliente = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cliente.connect(("192.168.1.73", 5000)) print("Se ha conectado al server") title="Tres en Luipy" msg="Selecciona una celda del tablero:" print("Turno del Servidor, espera a que termine su ronda.") try: codigo = cliente.recv(4096).decode('UTF-8') while codigo == "0": msgServerChoices = cliente.recv(4096).decode('UTF-8').split(",") msgServerTablero = cliente.recv(4096).decode('UTF-8') eleccion = easygui.buttonbox( msg=f"Tu turno Cliente.\n{msg}\n\n{msgServerTablero}", title=title, choices=msgServerChoices ) cliente.send(eleccion.encode("UTF-8")) codigo = cliente.recv(4096).decode('UTF-8') # print("He salido del while") easygui.msgbox( msg=f"Ha ganado el {"EMPATE" if codigo == "3" else "Server" if codigo == "1" else "Cliente"}", title=title ) except Exception as e: print(f"Se produjo un error: {e}") cliente.close()