# coding=UTF-8 def mandel(x, y, max_iter): iter = 0 a = 0.0 b = 0.0 while a*a + b*b < 4 and iter < max_iter: temp = a*a - b*b + x b = 2*a*b + y a = temp iter += 1 return iter Shades = "_.-'" scale = 20 max_iter = 20 buffer = "" for y in range(0, int(2.6*scale)): y0 = (y - 2.6*scale/2) / scale for x in range(0, int(3.5*scale)): x0 = (x - 2.5*scale) / scale iter = mandel(x0, y0, max_iter) buffer += Shades[int((len(Shades)-1)*iter/max_iter)] buffer += "\n" print buffer
Standard input is empty
______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________-.______________________ ______________________________________________..______________________ ______________________________________________....'___________________ _____________________________________________...'..___________________ _____________________________________________..''..___________________ ____________________________________________.'-''--.__________________ ___________________________________________..-''''-.__________________ __________________________________________...''''''.._________________ ______________________________________.......-''''....___-____________ _____________________________________..'..''''''''''.'...-.___________ _____________________________________..''-''''''''''''.----___________ _____________________________________..'''''''''''''''''''.___________ ____________________________________.-.'''''''''''''''''''.___________ __________________________________..'''''''''''''''''''''..___________ ________________________.............''''''''''''''''''''-.-__________ ________________________.-..........'''''''''''''''''''''''-__________ ________________________..-'..'.....''''''''''''''''''''''-.__________ _______________________...-''''''...''''''''''''''''''''''-.__________ _______________________...-'''''''--'''''''''''''''''''''''.__________ _____________________.-..-'''''''''''''''''''''''''''''''''___________ ____________________....-'''''''''''''''''''''''''''''''''.___________ ______________..._....-''''''''''''''''''''''''''''''''''..___________ ___________'''''''''''''''''''''''''''''''''''''''''''''...___________ ______________..._....-''''''''''''''''''''''''''''''''''..___________ ____________________....-'''''''''''''''''''''''''''''''''.___________ _____________________.-..-'''''''''''''''''''''''''''''''''___________ _______________________...-'''''''--'''''''''''''''''''''''.__________ _______________________...-''''''...''''''''''''''''''''''-.__________ ________________________..-'..'.....''''''''''''''''''''''-.__________ ________________________.-..........'''''''''''''''''''''''-__________ ________________________.............''''''''''''''''''''-.-__________ __________________________________..'''''''''''''''''''''..___________ ____________________________________.-.'''''''''''''''''''.___________ _____________________________________..'''''''''''''''''''.___________ _____________________________________..''-''''''''''''.----___________ _____________________________________..'..''''''''''.'...-.___________ ______________________________________.......-''''....___-____________ __________________________________________...''''''.._________________ ___________________________________________..-''''-.__________________ ____________________________________________.'-''--.__________________ _____________________________________________..''..___________________ _____________________________________________...'..___________________ ______________________________________________....'___________________ ______________________________________________..______________________ ______________________________________________-.______________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________