Friday, May 1, 2009


I have a "Fundamentals of Programming" class in being taught in MATLAB. I signed up for it because I wanted to get to a level of programming where I have confidence with it, the level where I can truthfully answer affirmatively if someone asks if I can program.

The class is at a little lower of a level than I was hoping, but honestly that's probably good since I have other (grad) classes that I should be focusing on. Even so, it's accomplished the goal: I feel like I'm proficient in the language and that I can solve arbitrarily complex problems with programming languages. I've had two encouraging programs... the first assignment was to simulate a baseball game. We had to simulate random pitching outcomes, keep track of base running, and scoring. It seemed like a totally unreasonable proposition at the outset, but once I got comfortable with the idea and the approach, it was a lot of fun, and I could have made it much more interesting if I wanted to spend more time on it (eg: realistic probability distributions for the pitching outcomes, some handling of forced outs on bases, maybe even some graphics that plot the trajectory of the ball and the base runners...). I had to force myself to stop playing with it.

Some students complained that the professor was taking an overly-high-level approach, and wasn't discussing actual MATLAB syntax, so he got into a specific example of finding the number of non-zero neighbors for a randomly distributed logical (one/zero) matrix. As I was figuring this out, it occured to me that it looks quite a bit like the ol' windows game MineSweeper. So I proceeded to spend a few hours programming a MineSweeper game. Its pretty cool. Its almost fully functional; the only thing I havn't implemented is the feature where the entire safe space is revealed if you click in a large empty area. At any rate, its playable, and I shouldn't spend any more time playing with it. Once I figure out how to make it into a freestanding program (playable outside MATLAB) I'll post it online. It's funny how much more entertaining it is to play a game I made myself, rather than the much slicker professionally made one.

No comments: