Commit f03586653d728f9c78ddbb594e8315bfd6d3ef6b

Authored by Mestari Yousra
1 parent a530adb2

algo principal du client

Showing 1 changed file with 43 additions and 0 deletions   Show diff stats
client.py 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +import zmq
  2 +import grille_client.py
  3 +import frappe_client.py
  4 +
  5 +context = zmq.Context()
  6 +
  7 +# Socket to talk to server
  8 +
  9 +socket = context.socket(zmq.DEALER)
  10 +socket.connect("tcp://147.250.9.87:5555")
  11 +
  12 +
  13 +while True :
  14 + print("Voulez-vous jouer?")
  15 + jeu=input()
  16 + if jeu=="PLAY":
  17 + socket.send_multipart([b'',b"PLAY"])
  18 + empty,reponse=socket.recv_multipart()
  19 + print(reponse.decode())
  20 + JouC=input()
  21 + socket.send_multipart([b'',JouC.encode()])
  22 + empty,reponse=socket.recv_multipart()
  23 + print(reponse.decode())
  24 + nom=input()
  25 + socket.send_multipart([b'',nom.encode()])
  26 + grille_client(J1)
  27 + if JouC =="P":
  28 + socket.send_multipart([b'',b''])
  29 + grille_client(J2)
  30 + empty,message=socket.recv_multipart()
  31 + while message.decode()!="jeu fini":
  32 + frappe_serveur(J1)
  33 + empty,message=socket.recv_multipart()
  34 + if message.decode()!="jeu fini":
  35 + frappe_serveur(J2)
  36 + empty,message=socket.recv_multipart()
  37 + elif JouC=="C":
  38 + #jouer contre l'IA
  39 + empty,victoire=socket.recv()
  40 + print(victoire)
  41 +
  42 + # Get the reply.
  43 + #message = socket.recv()
0 44 \ No newline at end of file
... ...