Another Haskell project, this returns samples from the mandelbrot set via TCP.
This is a server that returns the iteration count until escape for both mandelbrot and julia fractals. It doesn't do anything without a client, but a hacky ruby client is included in the download, so you can try it out immediately. The most notable aspect of this code is that it can do mandelbrot calculations to arbitrary precisions and iteration counts (at least until you run out of RAM). Clearly this causes it to slow down a bit, but it's nice as proof-of-concept.
Decoupling the point calculation from the rendering means it's possible to make some fancy interpolation systems and caching, driving them on a different host to the main renderer. Of course, that's also possible without massive network overhead, but where's the fun in that...
Download MandelNet.tar.gz.
The server is very simple — one client, one port, a simple ASCII request format. You can use telnet as a test if you like, it's designed to be easy to use.
Once you've connected to the host, simply send one request per line of the following format:
md iterations x y \nx + yi, where x and y are doubles and the iterations is an integer.
me iterations x y precision \nx + yi where x and y are doubles, iterations is an integer, and precision is a double (for example 0.1 to compute to the nearest tenth).
mp iterations xn xd yn yd \n(xn/xd) + (yn/yd)i, where x, y and iterations are all arbitrary-length integer values.
j iterations zx zy cx cy \nz = zx + zyi and c = cx + cyi, where everything but iterations is an integer.
The return value is always a single integer. If the point requested is in the given set the value returned is equal to the iteration limit used during the call. If something goes wrong the server will return 0.
The image on this page, and the log below, was generated using the poolclient.rb script from the tarball.
$ make $ ./md 4000 Listening on port 4000 Client connected: IPv4 "localhost.localdomain" 53973 |- Received: "md 10000 -1.0 -1.0" |- Received: "md 10000 -1.0 -0.937109375" ... |- Quitting at user request. +- Disconnecting client: IPv4 "localhost.localdomain" 53973