[ create a new paste ] login | about

Link: http://codepad.org/I6cd2H4k    [ raw code | output | fork ]

eschew - Python, pasted on Oct 30:
ITERS = 24
ESCAPE = 4

def mandlebrot(z):
	c = z
	for i in xrange(ITERS):
		z = z*z + c
		if abs(z) > ESCAPE:
			return i
	return 0

def m2c(i):
	return (i == 0) and ' ' or '*'

# size of output image
iw = 80
ih = 40

P = complex
# portion of mandelbrot set to display: corner + size
ll = P(-2.5, -1.5)
w = 4.0
h = 3.0

for i in xrange(ih):
	print ''.join([m2c( mandlebrot(ll + P(j*w/iw, i*h/ih)) ) for j in xrange(iw)])


Output:
              *****************************************************             
             *******************************************************            
           ***********************************************************          
         ***************************************************************        
        *****************************************************************       
       *******************************************************************      
      *********************************************************************     
     ***********************************************************************    
    ******************************************* *****************************   
   ********************************************    ***************************  
  ********************************************     **************************** 
  ********************************************    * *************************** 
 **************************************  *           ***************************
 ***************************************                 ***********************
*************************************                    ***********************
************************************                     * *********************
****************************** ******                     **********************
***************************      ***                       *********************
**************************         *                       *********************
***********************                                   **********************
**********                                              ************************
***********************                                   **********************
**************************         *                       *********************
***************************      ***                       *********************
****************************** ******                     **********************
************************************                     * *********************
*************************************                    ***********************
 ***************************************                 ***********************
 **************************************  *           ***************************
  ********************************************    * *************************** 
  ********************************************     **************************** 
   ********************************************    ***************************  
    ******************************************* *****************************   
     ***********************************************************************    
      *********************************************************************     
       *******************************************************************      
        *****************************************************************       
         ***************************************************************        
           ***********************************************************          
             *******************************************************            


Create a new paste based on this one


Comments: