by Leon Miller-Out
Last night I wrote this fun code to see if I could display a Mandelbrot fractal in my terminal. It was easier than I thought, thanks to some pseudo-code on the Mandelbrot Set Wikipedia page, although tracking down the proper UTF-8 code for the Full Block character did take some time.
Tonight I added keyboard navigation so you can move and zoom through the fractal. This is written in Ruby 1.9 using only core features (no gems or even stdlib)! If you're going to play with it, make sure you turn on the "Use bright colors for bold text" option in your Terminal preferences for full 16-color glory :-)
Here's the initial view in my standard-sized terminal:
And here's a nice zoomed-in view:
The code will detect the size of your terminal window, so you can use a big window with a really small font to get a pretty high resolution fractal:
Here's the code: