Topics › Python

Pygame Landscape generator

Today I came across this page, which contain many interesting things, including some sections on generating landscapes in a procedural way. I'd been meaning to try this for a while and I finally got around to it.

Python regression finder

I've been working my way through Stanford's online Machine Learning course recently and I thought I should put some of what I've learnt to use.

The program I made (file below) reads a file of tab-delimited data, assuming the first column is the independent values (x) and the second is the dependent values (y). It then gives some options:

Python SVG writer

I've written dozens of different Python programs that write SVGs of various types, so I thought it was about time I wrote a single generic module to make writing SVGs easy. Unsurprisingly, I'm not the only person to have had this idea, but rather than try to learn how to use someone else's module, I decided to write my one. It's more fun anyway. If anyone else wants to use the module it's available to download (and edit) on Github:

https://github.com/petercollingridge/DrawSVG

Python Fibonacci generator using reduce()

Khan Academy now has a series of videos on Python programming, and I've spent way too much of this weekend watching them, despite knowing all the basics of Python (I did learn a couple of things though). In fact, I spent so much time watching video, I finally broke the million point mark (and now have 77 points in binary):

My million points on Khan

Retrospectroscope

Today I wrote a small Python program that is likely to be of interest to almost no one else. Still, I like it because it uses modules I've not used much before and has the potential to be very useful if only could think of a suitable project. The program goes to Victoria's blog and find out what she was doing this time last year by parsing the relavant page in her Today section.

Project:

Python Bioinformatics Tools

Various tools I've written for myself in Python to help with simple bioinformatics tasks.

Sex in Sugarscape

Since the last time I wrote about Sugarscape, I've made a bit of progress. The biggest improvement is the introduction of sexual reproduction. I can therefore recapitulate more of the results of the original simulation, and test a number evolutionary ideas.

Horse race gambling simulation

I listened to the radio this morning and the host was talking about the Grand National, which is today.

Project:

Pygame 3D Graphics Tutorial

An introduction into how to create 3D graphics using Python and Pygame.

Pygame 3D wireframe viewer

I've been thinking about moving some of my simulations into the third (spatial) dimension for a while now. Actually creating a 3D simulation is relatively easy, it's just a matter of giving each point in space an additional coordinate. The difficulty is visualising the simulation. There's no easy way to transfer a 3D simulation to a 2D screen (or our 2D retinas).