Commit e95e1c143de9af3529639a59ef300a0287a40dc0

Authored by Trogno Lucas
1 parent a50c0e6a

programme du client

Showing 1 changed file with 25 additions and 10 deletions   Show diff stats
client.py
1 1 import zmq
2 2 from grille_client import grille_client
3 3 from frappe_client import frappe_client
4   -
5   -context = zmq.Context()
  4 +from IAattaque import attaque
6 5  
7 6 # Socket to talk to server
8   -
  7 +context = zmq.Context()
9 8 socket = context.socket(zmq.DEALER)
10   -socket.connect("tcp://147.250.8.139:5556")
  9 +socket.connect("tcp://147.250.8.126:5556")
11 10  
12 11 class Bateau:
13 12 "definition de la classe bateau"
... ... @@ -80,10 +79,26 @@ while True :
80 79 print(victoire.decode())
81 80  
82 81 elif PorC=="C":
83   - #jouer contre l'IA
84   - break
85   - empty,victoire=socket.recv_multipart()
86   - print(victoire)
  82 + victoire=''
  83 + while victoire=="":
  84 + empty,case=socket.recv_multipart()
  85 + print(case.decode())
  86 + case=input()
  87 + socket.send_multipart([b'',case.encode()])
  88 + empty,message=socket.recv_multipart()
  89 +
  90 + while "frappe" in message.decode():
  91 + print(message.decode())
  92 + case=input()
  93 + socket.send_multipart([b'',case.encode()])
  94 + empty,message=socket.recv_multipart()
  95 + print(message.decode())
  96 + if victoire=='':
  97 + empty,mes=socket.recv_multipart()
  98 + print(mes.decode())
  99 + empty,victoire=socket.recv_multipart()
  100 + victoire=victoire.decode()
  101 + print(victoire)
87 102  
88   - # Get the reply.
89   - #message = socket.recv()
90 103 \ No newline at end of file
  104 + else:
  105 + break
... ...