I made an Android app!

WCS App Screenshot
A screenshot of my Starcraft 2: WCS Android app

So, I’ve become a fan of watching professional videogames — in particular, Starcraft 2.  Unfortunately, since videogames aren’t yet popular enough to be covered by the likes of ESPN, it’s sort of difficult to quickly check the scores of popular matches on a smartphone.  I decided to try and build an app for my phone that would solve this problem.

Since I’m working on it only in my spare time, it’s been a pretty slow-going process, but today I released the first pre-alpha build.  It’s not feature complete, and it has crashes and display issues and all that, but it’s definitely usable, and I’ve definitely enjoyed learning about Android app development as I go along.  The source and releases and everything are hosted on github, which I’ve also really enjoyed using — git is a pleasure to work with, and I’ve found all the issue / release / etc. tracking that the site provides super useful.

The app is really simple right now — it only follows one series of tournaments, Blizzard’s official “World Championship Series” — it just has a main sort of “timeline” view that shows a brief summary of all the matches in the current season.  Those matches can be selected to view more detailed information, like what map was played, and what order games were played in.  The app pulls in fresh data every time it launches (currently in one huge file, which is on my list of things to fix) from a server that updates every five minutes.

Unfortunately, finding good, machine-readable Starcraft results is pretty tricky.  I ended up using Liquipedia‘s API to pull the wiki-formatted version of all the results pages, then running that through a parser (using the excellent, but oddly named mwparserfromhell package).  Liquipedia’s results are reasonably well formatted, and updated quickly by volunteers from an established community — without them, I don’t think this app would be possible.

In fact, since I’m about as far as you can get from a user-interface designer, I’ve also relied on Liquipedia for formatting / style; this has had the pleasant side effect of letting my app be understandable to anyone who is familiar with their site.  Since the WCS has a pretty complicated structure (e.g. there are four person group stages where the top two players advance, third place stays, and the fourth place drops out) this is quite the benefit.

I look forward to continuing development, though again, since it’s just done in my spare time, the timeline is pretty slow.  There’s a great deal going on at work which happily consumes a great deal of would-be free time as well. The grand finals of this years series are this coming weekend (Nov. 8-10), and I would love to have a version of my app in Google’s store before next year’s series begins, which is probably in early Spring 2014.  If you decide to try out any of the pre-release builds, you’ll have to let me know what you think!

A trip to Dallas

My press pass to MLG Dallas
My press pass to MLG Dallas

On Monday, I got back from my third (and final, for a while at least) trip to a major city.  I’ve previously discussed my trips to Boston and New Orleans, which were both for work, but this trip was to a huge Starcraft 2 / League of Legends tournament at MLG Dallas.  I went there with my friend Ethan and some other people from Leaguepedia, a wiki devoted to League of Legends that I volunteer some development time for.

I had been to an MLG previously (Columbus 2012), but this was my first time going as more than just a spectator.  It was a really cool experience — I got to meet a bunch of pro players / help with interviewing them, and had access to areas that were otherwise off-limits.  I’m a big fan of e-sports, and MLG is probably the event to attend (in North America, anyway) for professional videogame competition.

More than the event itself, though, I really enjoyed meeting the people I had been working with previously — the guys from Leaguepedia were all super cool, and the trip had a different pace than all the trips I’d been taking with SAnToS.  There also was an after-party, which was a total blast.  I got to meet a number of big names (Flash, djWheat, itmeJP, Day[9] and a whole lot more) which made it the highlight of the whole trip.

I’m definitely happy to be back home for a while, but traveling is / was a good time too.  Whether it’s my work with Leaguepedia or with SAnToS / K-State, meeting people in-person was fun, and makes working with them remotely much easier.

Matrix Multiplication in Haskell

As I mentioned in a previous post, I’m trying to learn Haskell.  I’m not progressing super quickly because it’s not a terribly high priority, but it’s sort of fun to think about programming problems in a totally different way.  While Haskell (being a functional language) definitely fits this niche, the book that I’m following does not include any exercises — you can sort of work the examples ahead of time and compare your solution to the book’s, but that’s a poor substitute.

I was helping a friend of mine (a sophomore in computer science) with an assignment he was working on recently, when it struck me that the straightforward, simple assignments he’s doing might make good projects to tackle in Haskell.  The course he’s in is a data structures course, so a lot of the projects have fairly simple input / output specifications, and somewhat complex backend requirements.  I chose to ignore the data structure parts (I’ll save implementing stacks / linked lists / etc. in Haskell for another day) and tried to tackle just the functionality.  The first (and so far, only) project I worked on reads in two matrices and either multiplies them or informs the user that the matrices’ sizes are incompatible.  The multiplication is straightforward — I’m not using the Strassen algorithm — and the input / output formats are easy as well.

The project turned out to be both more difficult and more instructive than I had planned.  Some observations I made while writing my program:

  • Parsing in a functional language is totally foreign to me.  The math wasn’t all that hard to grasp (though it wasn’t exactly straightforward either) but doing simple things like splitting a line into chunks (“tokens”) based on some delimiter is a completely new experience in a functional language.
  • Nearly all my methods have essentially one line of functionality.  I’m not sure if this is how Haskell is “supposed” to be written, or if it shows that I’m doing something wrong.  Either way, the length of functions is something I’m definitely going to pay more attention to when I look at examples in the future.
  • I’m not very good at list comprehensions.  Below are two ways of multiplying matrices: First, my way:

    Second, the way it’s implemented on rosettacode.org:

All in all, I learned a lot.  It’s some pretty ugly code, and I may rewrite it further, or tackle a different project from the same class and try to go about it in a better way.  If you’d like to look at my code or compile / run it (with the understanding this is just sort of doodling-type-code and isn’t documented or optimized or very good) feel free to download it.

Haskell and exercises

The Haskell logo, from haskell.orgIn fall 2011 I took a course that covered, among other things, proving program correctness with some software called Coq.  There's a lot to it, and I won't go into that here, but one important part of Galina, the language used in Coq, that I had been unexposed to previously was functional programming.  Functional programming is a style of programming (a paradigm, in the parlance of our times) that a lot of computer science students learn as undergraduates.  I didn't, though, so this course – which used but did not teach functional programming – was quite challenging.

I ended up slugging my way through the class, and learning lots.  I  wasn't satisfied with my understanding of functional programming, though, so I decided to learn Haskell on my own.  Haskell is a pretty modern functional programming language that I'd heard lots about as an undergrad from a friend named Alan Mock (it doesn't look like he updates his blog, which is a bummer, since he's super smart and has lots of interesting opinions).  Not wanting to learn from some old, crusty, book full of greek symbols (since I get enough of that at school), I found the least-crusty programming language book ever: Learn You a Haskell for Great Good!, by Miran Lipovača.An octopus, as drawn by Miran Lipovača.

It seems to me like a somewhat narrowly targeted book – it assumes some knowledge of imperative programming, pop culture (from the time I was a child – teenage mutant ninja turtles, etc.), and a sense of humor.  That's not to say that any of these things are required, but I think you'll miss quite a bit of the joy in the book without them.  Since I'm mostly in the target audience, though, I really like the book.  I'm only a few chapters in, but it does an excellent job of explaining (what seem to me to be) pretty tough concepts.  My one complaint about the book, though, is that it doesn't have any exercises.  Without a way to test yourself at the end of a chapter or section, it's hard to tell if you've actually learned anything – I find myself playing around with the given examples / trying to figure out why they work or don't work.  That definitely helps, but it's not as direct as just working through exercises.

As an example of just how valuable exercises are even for short technical descriptions, here's a program called Logitext: it's an "educational proof assistant for first-order classical logic using the sequent calculus."  The author has an excellent tutorial, with examples throughout and some interesting problems at the end.  After just reading through the tutorial you may have some trouble with the exercises (I know I did) but after completing them, the knowledge seemed to "gel" a lot better.

The Haskell logo is from haskell.org, and the octopus playing guitar hero is from Learn You a Haskell for Great Good! by Miran Lipovača.


My jack-o-lantern during the day

It was recently Halloween, which means in addition to my normal fall regimen of sleeping through football games, I carved a pumpkin and bought candy for local children. It had been a long time since I'd made even a basic Jack-O'-Lantern (like 15 years) but it turns out that if your design consists almost entirely of straight lines, it all comes back pretty quickly. I got pretty fortunate with the pumpkin selection — I bought the pictured squash at about 5.00pm on Halloween.

Though everything is officially over, I'm not ready to give it up quite yet. Our house only had two groups of trick-or-treaters, so there's a ton of candy left, and the smallest package of tea lights Target was selling was a 100 pack, so there's lots more of those too. I suppose I could save all of them, but when you move houses / apartments almost yearly, stuff like tea lights get forgotten pretty easily.

Since it isn't Halloween without a scary movie, my roommates and I sat down to watch a vampire movie called Let the Right One In. I really hate scary movies, but I was told by my brother (who recommended the film) that it was "Art-House Horror" and not actually all that scary. I'd have to agree — there were scary parts, but it wasn't ever really too much.  The film was very good, though it's subtitled, so if you hate that you'll want to stay away.  Then again, if you're the type of person who hates subtitles, art-house anything probably isn't your style ;)

My jack-o-lantern during the night