Minesweeper Automation
October 26th, 2008 Filed Under code, games, portfolio, projects
A few years ago, I was playing a lot of Minesweeper, and I realized that I was spending most of my time implementing two very simple rules repeatedly:
- If the number of mines indicated by this square is equal to the number of neighboring mines already flagged, clear any uncleared/unflagged neighbors.
- If the number of mines indicated by this square is equal to the number of neighboring mines already flagged plus the number of uncleared neighbors, then flag all uncleared neighbors as mines.
These rules should be obviously correct to anyone who’s ever played Minesweeper; in fact, I can’t even imagine making any progress in a Minesweeper game without them. So I decided to implement these rules in Gnomine, the open source version of Minesweeper that comes with Gnome on Linux. It only took me a few hours before I had this patch (applicable to gnome-games v2.20.1). Of course, this patch assumes that no mines are ever incorrectly flagged, but I think that’s a reasonable assumption.
And after playing with it, it’s surprising how much of the board can be cleared mechanically before you ever even get to any interesting decisions. When the sweeping does stop, what’s left are a few random decisions, where you can’t do any better than a 50/50 guess, and also the genuinely interesting positions where you have to apply set theory to make deductions.
I sent this patch off to the gnome-games mailing list owner, and have yet to receive a response. I’m sure that adding minor features to gnomine is absolutely no one’s top priority, but maybe if someone else has been similarly inspired, they might find this patch useful.
Youtube to MP3 Converter
August 19th, 2008 Filed Under code, portfolio, projects
My mom found some of her favorite music on Youtube. She’s been looking for some of these songs for a long time, and now that she’s found them, she’s scared that Youtube will pull them and then she won’t have them again. She wants to download them so she can listen to them whenever she wants. The CDs are out of print. There are several torrents of this artist’s music that were around in 2006, but now they have 0 seeders (and 3 leechers). legalsounds.com has them for 10 cents apiece, but I cautioned her against giving her CC number to the Russians.
I know the quality of audio on Youtube is pretty bad, but she doesn’t care. She’s excited that she can finally listen to these songs again, and she’d be content with just having an mp3 constructed from the Youtube videos. In fact, she’d be ecstatic.
How hard can this be? I’m learning some jQuery myself–it’s all the rage, what with the mashups and the AJAX–and I thought I could make a simple client-side webpage that AT LEAST just gets at a user’s favorites from youtube and prints the URLs of each .flv for download. Youtube has a nice little API, you just GET from a sensible URL, and it returns XML. jQuery has some nice functionality to get elements from the XML and I would just add a few rows a table with the right information. No problems anticipated.
[More...]
Project: Reasonable Goods
November 25th, 2007 Filed Under activeprojects, portfolio, projects
I realized I haven’t actually made a post about my main venture of late, Reasonable Goods. For any given consumer product category, there’s usually one brand or model that stands out as a great value. It’s not necessarily the cheapest, and it’s probably not the best, but it gets the job done, and it won’t be missing that one feature that everyone says you need.
The Swedish have a word, lagom, that captures this concept in its essence. In English, there is no direct equivalent, but it is often translated as “reasonable”.
Check it out! I’d love some feedback.
A Creation Myth for Science
August 5th, 2007 Filed Under featured, portfolio, science, writing
Here is a scientifically accurate creation story, in the style of Genesis I. I did my best to keep mysticism, remove Yahweh, and incorporate certain substantial omissions from Moses’ version.
In the beginning there was everything, and everything was one; eternal and without measure.
And the universe exploded into being, forming the first element and the second element in the proportion of three to one, creating the billions of galaxies and nebulae; and by the thirteenth eon there were billions of ancestral suns.
The ancestral suns burned the first element for several eons to form the second element and the third element and so on down to the twenty-sixth element; and the ancestral suns collapsed each in their time, and exploded in every direction; and from their remains arose the billions of elder suns.
The elder suns burned for several more eons, and further formed the second and third elements and so on down to the twenty-sixth element.
And the elder suns collapsed each in their time, and exploded in every direction; and the heavens were filled with stars, including the Sun: and they have burned for several eons and will burn for several more. So the ninety-two elements were created; and they settled to form the planets, including the Earth which came to orbit the Sun; and also the moons, including the Moon which came to orbit the Earth.
So the Earth spun night and day and night again, and the rock and ocean and atmosphere was separated by the fifth eon; and volcanoes made mountains; and rivers carved canyons; and the Moon brought the tides; and the wind blew and the rain fell without question.
In the ocean there came to be a form of proto-life, which was reproduction; reproduction begat evolution; evolution begat metabolism; and by the fourth eon there were simple cells.
Some simple cells became proto-plants, which ate from the sun; but their waste accumulated and became poison to them. And some simple cells became aerobia, which ate the bodies and breathed the waste; and by the third eon the eighth element had come to equilibrium in the atmosphere.
The simple cells and proto-plants and aerobia evolved independently; and by the second eon they had merged into compound cells, which ate from the Sun, and also the Earth.
Some compound cells became joined and formed coral and fungus; and one cell brought forth many cells that grew differently, yet functioned as one. And by the first eon, the earth had vegetation.
Vegetation became plants yielding seed, and trees bearing fruit in which is their seed, and flowers feeding insects which spread their seed. And there came to be fish in the ocean, and birds in the air, and all manner of animals along the ground; the larger ate the weaker and the smallest ate the waste, and it was equilibrium.
And it came to pass that australopithicus, which walked upright on two feet, begat homo habilis, which hunted with tools; habilis begat erectus, which captured fire; and erectus begat sapiens, which moved their tongues in speech.
Now it is the end of the first eon; and homo sapiens is man and woman.
Orgo: An Organic Chemistry Board Game
March 25th, 2007 Filed Under portfolio
In 2004, I put aside work on Mitochondrion and started work on Orgo, a “board game” meant to illuminate core principles of biochemistry, particularly the molecular structures and relative energies of simple biological molecules. It’s one of my many latent projects, but it’s complete enough to show and see if anyone out there wants to collaborate.