def get_num_escape_turns(x, y):
 c = complex(x, y)
 z = complex(x, y)
 num_iterations = 0
 while ((MIN_MAGNITUDE < np.absolute(z) < ESCAPE_MAGNITUDE) and (num_iterations < MAX_ITERATIONS)):
  z = ((z ** 2) + c)
  num_iterations += 1
 return (float(num_iterations) / float(MAX_ITERATIONS))

def get_num_escape_turns ( x , y ) : c = complex ( x , y ) z = complex ( x , y ) num_iterations = 0 while ( ( MIN_MAGNITUDE < np . absolute ( z ) < ESCAPE_MAGNITUDE ) and ( num_iterations < MAX_ITERATIONS ) ) : z = ( ( z ** 2 ) + c ) num_iterations += 1 return ( float ( num_iterations ) / float ( MAX_ITERATIONS ) )
returns the number of iterations it took to escape as normalized values .