Feb 18, 2009

Stupid game programming in Python

So i decided to write a short game like thing in python using pygame (fun library). It became known as pizza-shamrock even though i was initially going for some type of sumo wrestling like game. I guess it all started as me wanting to use pythons native support for complex numbers for awesome. I had just come out of a complex analysis course and it seemed obvious that the position of the sprites in any game should be represented by complex numbers.

I know it sounds insane. Its clear its not a great idea to represent their position with two integers, but you could at least just use a vector right? That would be better right? maybe...

Historically, complex numbers and their 4d friends, quaternions, came about long before vector notation became the standard for describing physics. This isn't a mistake, complex numbers and quaternions form a beautiful algebra, unlike vector math. Complex numbers have multiplication and addition as operations. Vectors have addition and a two different kinds of multiplications and man its not as cool, either trust me or take complex analysis.

In short by using complex numbers im able to do cool tricks that would be much harder to do with vectors. Like, i can transform the game to polar coordinates by complex exponentiation. With a vector id have to use trig. I don't really understand how Python does complex exponentiation natively, esp since you have import a math library to do trig, but whatever.

If you don't believe me that the weirdness of complex numbers is worth it, read the quaternion article. They're being used more and more in computer graphics to succinctly describe transforms that would normally be ugly as hell with vectors.

I guess you can argue that for maintainability reasons (cuz very few people are comfortable with complex numbers) my code should've used vectors. So im not really arguing that complex is the way to go, im just arguing that its awesome.

Jan 11, 2009

late winter break.

Not much to say apart from snow viewing. Can't say i feel really good about education right now, but im more relaxed than I normally would be.

Not sure where to devote my efforts now: quaternions, tensors, numeric algorithms, stupid stuff in python, human syntax, japanese.

Its hard convince myself that ive done anything, or that im allowed to relax.
This is sinning at its worst.

Dec 16, 2008

connections

Ive always thought it was interesting how much of first half of 20th was spent on understanding our limits. Relativity tells us we can't go past the speed of light. Quantum mechanics tells us that our ability to concretely talk about things goes to hell when we get on small scales. Turing showed us how weak our computers are, and Godel showed that we can't even really come up with a consistent model of logic. Lorenz showed how the nonlinear world behaved so erratically, making weather prediction hopeless. I guess thats 5 examples: 3 from math, 2 from physics. Thats all i can really think of that fits.

Thats what i think of that era in thought. Realizing we are limited. Ive read that at the turn of the century, many thought that physics as a field was dead because pretty much everything had been discovered. How cocky.

Dec 14, 2008

Games

I was thinking about monopoly a couple of nights ago and it occurred to me that the game is a piece of our culture. However, monopoly, is drastically different from lets say chess, go, shogi, chinese chess, cards... etc because its "owned". Over time the game has slowly made more and more complex until being mass manufactured has become the only option for the game.
And so now im considering what it would be like if the game were streamlined and made more abstract. I think it would be beautiful.

Dec 13, 2008

like that

iono if ill remember it, but im happy after a couple of hours.

Dec 6, 2008

So I was wrong

Of course.

Dec 4, 2008

Its that time of year again

Yes that time of year, the end of the semester. Right now im procrastinating studying for a complex analysis test. As always i use this time to review how this semester went.

If i really force myself to look at my school work, its pretty clear that this semester was educational, even if i don't want to admit it. Unfortunately, Ive also learned that im not nearly as interested in some of the subject areas i once thought i was. Completing my major will involve work that im not interested in after all and my boredom with classwork seems to border ever closer into danger. I couldn't have lasted 4 years of imsa, I can't imagine lasting 4 here.

What impresses me most is my more personal life. Even though I didn't meet any of my unrealisitic goals, it seems strange to say that just 4-5 months ago i didn't know anyone like me. I remember thinking a year ago about where id be in this process now. Whoever I was a year ago is so distant from me now, at least rationally.