Monday, January 7, 2008

To My Naysayers

You know you you are. I have successfully created a way to generate examples of first and second order differential equations. A little backstory is in order I guess.

I mentioned my game engine in an earlier post. At this point, it's far from done, but it's functional. I put that on hold to make my game demo, which uses what I have so far of the engine. Independent of all this, I had the idea to make a game called Differential Equation Munchers, a parody of the classic Number Munchers, which the lucky among us had a chance to play in our elementary school Apple labs. I've decided to use this opportunity and make this as my demo.

In the original game, you're given a category of things, such as "Multiples of 4". You walk around the board and eat the numbers that fit into that category. But watch out for the Troggle! Troggles can come into the board and eat you, so avoid them. You also die if you eat a number not in the category. You win the level when you eat all the numbers in the category.

For my version, the categories are related to differential equations. Which means that I have to somehow render differential equations. My thought was that I would generate them on the fly. Someone else suggested that I should have a table instead. Supposedly, writing a generator would take too long. I didn't want to make a table, I said. Either I would have too small a pool of possible answers, or it would be a real pain in the ass making a huge table by hand in Gimp. Plus, come on, that's lame. Right?

Well, this weekend, I made a generator for First and Second order differential equations. I decided that, yes, if my categories were things like solutions to the differential equation y' = 5xy + 7, I may be facing way more work than I intended, because I would have to solve Dif Eq's on the fly. However, if it's just categories like First Order Differential Equations, then it's a simple matter of generating an equation that happens to have a y' in it (and some other rules). My program doesn't have to have any notion of solving or understanding a differential equation, it's just a dumb image generator. Read 'em and weep:


(click to embiggen)

Granted, this is a simplified version of what I want ultimately. I can take more time to make generators for that stuff later. This is good enough for my demo. Also, for the more complicated stuff down the line, there is a Python library called sympy that can help me manipulate algebraic expressions.

Anyway, I'm happy about that. The game is in fact playable now. I have to add things like number of lives, score, splash screens, difficulty, etc. Then it'll be fully functional. Then I'd have to go clean up pictures (making the dif eq's more readable would be a good start). Also putting the original artwork in. Then I'll have to add more categories of equations. Then it'll be suitable for a demo.