blogs tagged "programming"

Learning Python by building image-pooping Markov chains

Fri Dec 19 2008 23:41:05 GMT-0800 (Pacific Standard Time)

tags: python programming markov

In my ongoing attempt to learn yet another utilitarian programming language, I have decided to pick up some Python. I'm only still scratching the surface (for example I haven't even touched python regular expressions yet, nor object persistence/marshalling), but I've managed to make a few toys. I often learn best by just diving in and doing, and I've come to enjoy stumbling through toy projects when learning a new language.

So I thought it would be interesting to see what kind of images I could create with a self-modifying, mutative Markov chain. While the results below aren't yet self-modifying, they're somewhat entertaining eye-candy that's probably been done hundreds of times before.

image image image image image image image image image image image image image image image image image image image image image image

I'm using the Python Imaging Lirbary (PIL) to create/paint the images. Sure, it's pretty well documented and intuitive, but doesn't immediatly support drawing with alpha transparency, which is a real bummer. There is at least one other drawing toolkit that does alpha, and one that does that with opengl. It would be nice to render these in realtime, but the current incantation seems to take about a second to do about 54k 2d polygons, which isn't exactly fast. I'm also not yet sure how much of that time is spent in python versus actual Tk rendering.

I'm now mostly interested in switching drawing toolkits to support alpha, doing marshalling to save/restore interesting chains, and coming up with interesting strategies of self-modification. The current models are very linear, and it might be nice to have a little abstraction that allows nonlinear curving to happen more seamlessly.

I'll probably share the code after I continue to learn from my mistakes and make things more better.

Lily is pretty sweet.

Sun Mar 04 2007 23:40:41 GMT-0800 (Pacific Standard Time)

tags: dataflow programming web

I lurk on various PureData lists and get quite a bit of mail in digest format. It's often enough to skip over or skim very quickly, but recently the author of Lily posted OT about web patching via javascript...and wow. What cool stuff. Now don't misunderstand....I've gone on record bagging on this whole AJAX thing and how the web browser is a terrible "platform" for all this software we like to run (a windowing environment or even OS in a browser is totally redundant, no?)...but this looks damn fine. I haven't tried a demo or anything, but the movies look quite nice. Although maybe a bit simple and cryptic, the few examples of full "applications" (if dataflow languages create apps anyway?) being whipped out in a few mere minutes is, to me, pretty impressive. I suspect that [parts of?] it may be Firefox specific, which is probably less than ideal, but again, it looks to work really well! When I first read about this project, it immediately reminded me of Yahoo Pipes, which has been making the 'rounds. This is like a streamlined, less AOL version of the same...one that (to be fair, without a demo!) seems to actually work well, in an efficient and more intuitive (at least to us patchers) way.