def judge(zcontext, in_url, pythagoras_url, out_url):
 isock = zcontext.socket(zmq.SUB)
 isock.connect(in_url)
 for prefix in ('01', '10', '11'):
  isock.setsockopt(zmq.SUBSCRIBE, prefix)
 psock = zcontext.socket(zmq.REQ)
 psock.connect(pythagoras_url)
 osock = zcontext.socket(zmq.PUSH)
 osock.connect(out_url)
 unit = (2 ** (B * 2))
 while True:
  bits = isock.recv_string()
  (n, m) = (int(bits[::2], 2), int(bits[1::2], 2))
  psock.send_json((n, m))
  sumsquares = psock.recv_json()
  osock.send_string(('Y' if (sumsquares < unit) else 'N'))

def judge ( zcontext , in_url , pythagoras_url , out_url ) : isock = zcontext . socket ( zmq . SUB ) isock . connect ( in_url ) for prefix in ( '01' , '10' , '11' ) : isock . setsockopt ( zmq . SUBSCRIBE , prefix ) psock = zcontext . socket ( zmq . REQ ) psock . connect ( pythagoras_url ) osock = zcontext . socket ( zmq . PUSH ) osock . connect ( out_url ) unit = ( 2 ** ( B * 2 ) ) while True : bits = isock . recv_string ( ) ( n , m ) = ( int ( bits [ : : 2 ] , 2 ) , int ( bits [ 1 : : 2 ] , 2 ) ) psock . send_json ( ( n , m ) ) sumsquares = psock . recv_json ( ) osock . send_string ( ( 'Y' if ( sumsquares < unit ) else 'N' ) )
determine whether each input coordinate is inside the unit circle .