This is Python code to create biomorphs, as discovered by Clifford A. Pickover and described by A. K. Dewdney in an article in Scientific American's "Computer Recreations" column, in August 1985.
I read that article as a young teenager, and wrote code in C++, compiled with the Borland C++ compiler, displaying the results using Borland's BGI graphics library (DOS). That's if I remember correctly. I seem to remember that I could take advantage of the complex math library in the early days of the C++ language, making the code that much nicer to write. However, I was running it on a 386 computer with no math coprocessor, so patience was a virtue. I'm not sure where the code is that I wrote. Gone forever, I suspect!
In a fit of nostalgia I tried to look it up on the internet a few years ago. But couldn't find anything. I tried to reconstruct the essence of the algorithm from memory. I failed. But more recently I was able to find some links, which filled in a missing piece of the puzzle. Now I'm doing this in Python, even though that's sure to give me slow run times compared to C++. What I lose in speed, I gain in convenience. Funny, it still seems faster than my old C++ code on that 386.
There are a number of links that have popped up recently, and here are the ones I found most helpful, and with some good-looking biomorphs on display.
This code was just me playing around, so it's not especially well structured. But it does separate the mathematical function from the colour function, and allows the range on the cartesian plane as well as the output graphic size to be easily specified as parameters.
It depends on:
- Python 2.6 (maybe 2.5 or earlier would be okay, I forget)
- Python Image Library
- For Windows only, to set the process priority to low, depends on pywin32
This code is under the MIT license:
Copyright (c) 2009 Craig McQueen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.