Monday, March 16, 2009

Random Magical Thoughts

I usually like to write about one coherent thought for about three paragraphs but I’m stumped. So today I’m going to write about two or three ideas.

First, Magic is a complicated game and trying to construct a basic user interface (UI) for it is hard. I keep thinking that I’ll rewrite the UI but I know it will be hard and frustrating since I’ve never done anything like that before. I really enjoyed the UI for the previous version of Magic Online and the UI for Shandalar was very clear and easy to use.

Basically I’m not a very visual person and I can’t tell what looks good and what doesn’t. My only hope for a better UI is to copy a preexisting one. I understand Shandalar’s UI the best but I will be doing good if I can write something that looks half as good.

Second, Java is my programming language of choice but it still gives me problems. The problem is that there are many different versions of Java which are supposed to work the same way but they don’t. The newest version of Java is 1.6, which is all fine and dandy, but the user interface looks different between 1.4 and 1.6 and I wrote MTG Forge with 1.4. (The user interface is “more white”, making it harder on the eyes.) And other problems abound, such as Java 1.4 code will compile with 1.6 if you turn off all the warnings, which is usually considered a bad, lazy approach to programming.

Third, MTG Forge’s source code is about 1.5 MB uncompressed and 271 KB zipped, which is about the size of Charles Dickens “A Tale of Two Cities”, 294 KB zipped. You might be wondering why am I comparing zipped sizes between Java source code and plain text? The answer is that if two things compress to the same size they have about the same amount of information.

I have no idea which project took longer to write but by compared zipped sizes, we know that they have about the same information. (Although hopefully my program is more interesting than an old book, but who knows?)

p.s.
Information theory is part of computer science which deals with the theory behind computers and how to code better programs.

9 comments:

Gando the Wandering Fool said...

I think it might be an unfair comparison as Dickens was a grandmaster author and his novel "A Tale of Two Cities" is clearly one of the top stories written in the english language. So don't do that.

MTG Forge is an entirely different concept altogether and its purpose is vastly different too. Also I do not wish to offend you but your code could probably be seriously refactored changing its information density dramatically. And during the refactoring process you might discover ways to accomplish what you thought of previously as too hard to do.

I wish you luck with your endeavors with this.

gyom said...

I don't think he was referring to the style/quality of the works, but just to the "information" contents. I could have compared it with anything without suggesting that the thing in question was something he could have written.

I'd point out that zipping something doesn't really tell the whole story. If you had a text file containing a gigabyte worth of decimals of sqrt(2), I really doubt that the zip compression scheme would realize that and compress it as such. It would take around a gigabyte, failing to see any regularities and missing completely our intuitive notion of information.

Anything that compresses has to make assumptions about the data. David MacKay has a pretty awesome book on Information Theory available for free online as pdf.

It's always more inviting to post a reply to something when we know the author has missed some detail that we want to point out, but I enjoy reading your posts and, when I don't comment, it's usually because I've read in diagonal or because I agree to what you said in general.

Forge said...

I read an interesting book about how compression and learning are very similar since they involve prediction.

Dickens and MTG Forge's source code are basically both just text so that is why I compared them. It would have been more accurate to compare MTG Forge to another well known program (although I have no idea what program is another good comparison).

Even though MTG Forge a lot of copy-and-pasted code in CardFactory, hopefully the zip compression would remove most of than redundancy.

Forge said...

Here is a link to David MacKay book on "Information Theory, Inference, and Learning Algorithms". It sounds good, hopefully I'll learn much from it.

Download Site

Forge said...

After looking at the book you probably need more than Calculus 3, which is the highest math class I took. I like books written by programmers and not mathematicians.

Programming is not math and vice versa.

gyom said...

Yeah, well, it's not meant to be a book about popular programming topics like OOP or OpenGL. It's a book about statistics, "machine learning" and coding theory (not "coding" as in "hey, I'm coding in C !").

I was just pointing out that book because you mentioned information contents. I won't help you at all for MTG. Or, at least, not directly.

Forge said...

It was interesting to look through though so thanks for suggesting it.

Unknown said...

Calculus ruined my basic math skills. 2 plus 2 is a value approaching four....

gyom said...

It's more like :

Given two numbers A and B that can both be made arbitrarily close to 2, you can make the number A + B arbitrarily close to 4.