Genetic Programming

monalisa

[Ron Alsing] wanted to try out some genetic programming, so he created a simple test problem: Could you render the Mona Lisa using just 50 semitransparent polygons? The program starts with a random DNA sequence. It then mutates and compares itself to the original image. If the mutation is closer, it becomes the new sequence. The final image he shows looks pretty good after 904,314 iterations.

[prunesquallor] pointed out a genetic algorithm project of his own. It’s a flash program to evolve a car. The car tries to get as far as possible on a set terrain without the passenger circles hitting the ground. The wheel size and positions can change along with the spring length, constant, and damping. A graph tracks the best performance along with the mean. He’s planning on building a version that lets you change the parameters.

[via Waxy]

Python 3000 Officially Released

python3k

Python 3000 has officially been released. The final bug, Issue2306, “Update What’s new in 3.0” has been closed. Python 3000, py3k, Python 3.0, is a major release for the community. [Jeremy Hylton] pegs the earliest mention of the beast to January 2000. The new release has grown from PEP 3000, opened April 2006.

Py3k breaks backwards compatibility with previous releases in order to reduce feature duplication and promote one obvious way of getting things done. The first major change is that print is now a builtin function and not a statement. int and long have been unified, and integer division now returns a float. Py3k uses concepts of “text” and “data” instead of “Unicode strings” and “8-bit strings”. You can read about many of the changes in What’s New In Python 3.0. Some new features have been backported to Python 2.6 so you can start implementing them in your current code to ease the transition. 2.6 also has the -3 command line switch to warn you about features that are being removed or changed. Finally, the tool 2to3 is a source-to-source translator that should automate a lot of the changes.

Documentation for the new release is online. Source packages and binaries are available now.

[via johl]

Strunk & White Can Apply To Programming

The Elements of Style by [William Strunk, Jr.] and [E.B. White] has long been a favorite of English majors and great writers. [James Devlin] suggests that it can also be a good reference for programmers. With just a few changes in wording, the same guidance that applies to good writing can apply to good coding. For example, [Strunk] and [White} emphasize the importance of structural design to writing. Replace “writing” with “programming”, and the principles are exactly the same: “Programming, to be effective, must follow closely the thoughts of the writer programmer, but not necessarily in the order in which those thoughts occur.” So keep this guide in mind next time you start a new project.

[via Kottke]